Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)
Home

[Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Thu, 6 Sep 2001 01:41:04 -0700 (PDT)

> > > +  char wallbuffer[2048];
> > > +  wallbuffer[0]=0;
> > > +  cat_snprintf(wallbuffer, sizeof(wallbuffer),"%s",str);
> > 
> > What about strncpy? printf seems like overkill here.
> > 
> > Otherwise it looks fine.

Just do this:

strncpy(wallbuffer, str, sizeof(wallbuffer));
wallbuffer[sizeof(wallbuffer)-1]='\0';


That's all you need.  Could make the buffer size a #define if you wanted.  The
*nprintf functions are often very inefficient.



[Prev in Thread] Current Thread [Next in Thread]