[Freeciv-Dev] Re: Fwd: Re: Re: Request (PR#939)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > > + 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.
|
|