Hi

Sure, so what are you saying... we shouldn't change this?

Or we should change it? If so, why not also change, for example,
cvs_add_entry, cvs_remove_local and update_clear_conflict, which have
very similar bits of code?




On Mon, Nov 02, 2015 at 03:38:24PM -0500, Michael McConville wrote:
> Nicholas Marriott wrote:
> > Sure, but this idiom is all over the place in opencvs, are you going to
> > change the rest?
> 
> As Theo mentioned recently, there's an inherent tradeoff here. Stack
> allocation is faster at runtime and easier to write. However, we miss
> out on malloc's memory sanitization. So, maybe we should only change it
> in performance-relevant areas where we're very confident in the safety
> of the program logic.
> 
> > On Mon, Nov 02, 2015 at 12:31:14PM -0500, Michael McConville wrote:
> > > Don't bother mallocing a statically-sized 1,024-byte chunk of mem, for
> > > simplicity and speed.
> > > 
> > > ok?
> > > 
> > > 
> > > Index: usr.bin/cvs/server.c
> > > ===================================================================
> > > RCS file: /cvs/src/usr.bin/cvs/server.c,v
> > > retrieving revision 1.102
> > > diff -u -p -r1.102 server.c
> > > --- usr.bin/cvs/server.c  16 Jan 2015 06:40:07 -0000      1.102
> > > +++ usr.bin/cvs/server.c  2 Nov 2015 17:17:13 -0000
> > > @@ -323,7 +323,7 @@ void
> > >  cvs_server_directory(char *data)
> > >  {
> > >   CVSENTRIES *entlist;
> > > - char *dir, *repo, *parent, *entry, *dirn, *p;
> > > + char *dir, *repo, *parent, entry[CVS_ENT_MAXLINELEN], *dirn, *p;
> > >  
> > >   if (current_cvsroot == NULL)
> > >           fatal("No Root specified for Directory");
> > > @@ -357,13 +357,11 @@ cvs_server_directory(char *data)
> > >           fatal("cvs_server_directory: %s", strerror(errno));
> > >  
> > >   if (strcmp(parent, ".")) {
> > > -         entry = xmalloc(CVS_ENT_MAXLINELEN);
> > >           cvs_ent_line_str(dirn, NULL, NULL, NULL, NULL, 1, 0,
> > >               entry, CVS_ENT_MAXLINELEN);
> > >  
> > >           entlist = cvs_ent_open(parent);
> > >           cvs_ent_add(entlist, entry);
> > > -         xfree(entry);
> > >   }
> > >  
> > >   if (server_currentdir != NULL)
> > > 

Reply via email to