On Thu, Jun 21, 2007 at 11:08:25PM -0700, chromatic wrote:
> On Thursday 21 June 2007 17:44:38 Mark Glines wrote:
> 
> > On Thu, 21 Jun 2007 17:38:15 -0700
> >
> > chromatic <[EMAIL PROTECTED]> wrote:
> > > > -            return string_from_cstring(INTERP, "Str", 3);
> > > > +            return string_from_cstring(INTERP, "Bool", 3);
> > > >          return SUPER();
> > > >      }
> 
> > > That 3 looks like it should be 4.
> 
> > Yep, fixed in r19238.
> 
> We have a lot of string_from_cstring() calls with constant second parameters 
> and third parameters of 0 that could use updating.  There's no sense in 
> calling strlen() all the time.

I think that you need something like this

/* concatenating with "" ensures that only literal strings are accepted as 
argument */
#define STR_WITH_LEN(s)  (s ""), (sizeof(s)-1)

/* STR_WITH_LEN() shortcuts */
#define newSVpvs(str) Perl_newSVpvn(aTHX_ STR_WITH_LEN(str))

...

(Credit to chip for the concatenating with "" trick)

Nicholas Clark

Reply via email to