[PATCH 01/24] lib/message.cc: stale pointer bug
Vladimir Marek
Vladimir.Marek at Oracle.COM
Thu May 2 06:45:30 PDT 2013
> > int prefix_len = strlen (prefix);
> > - const char *term = NULL;
> > + std::string term;
> > char *value;
> >
> > i.skip_to (prefix);
> >
> > - if (i != end)
> > - term = (*i).c_str ();
> > + if (i == end)
> > + return NULL;
> >
> > - if (!term || strncmp (term, prefix, prefix_len))
> > + term = *i;
>
> ... hmm, a raii(?) solution above would be std::string term = *i;
I'm not sure what's raii (I'm not very good at c++ ...), but I guess you
mean to use 'std::string term = *i;' to avoid copy constructor. That
surely is a good idea. Let me rework the patch!
--
Vlad
More information about the notmuch
mailing list