Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2000:
[Freeciv-Dev] [PATCH] my_vsnprintf() (PR#606)
Home

[Freeciv-Dev] [PATCH] my_vsnprintf() (PR#606)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] my_vsnprintf() (PR#606)
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: Sun, 19 Nov 2000 05:19:29 -0800 (PST)

Some of you might remember that I posted a patch a few months ago that
aimed to improve the my_vsnprintf() function and friends.
Specifically, I wanted Freeciv to use pre-C99 vsnprintf() functions,
which return -1 on truncation rather than the number of bytes that
would have been written.

I have been wondering for some time what happened to this patch.  A
couple of days ago I realised that I'd forgotten to mail it to bugs@ ,
which I suppose explains things.

In any case, here is a (slightly cleaner) version of that patch.  It
solves the pre/post C99 issue by always returning -1.  This doesn't
lead to any difficulty, since there is only one place in the Freeciv
sources that actually makes use of the C99 return value, and even
there it's very important.

This patch also dispenses with the checks to see whether or not
vsnprintf() actually truncates its output.  I'd be happy to bring this
back, probably as a configure test, but are there really any platforms
of note that are broken to this extent?  Removing this test produces a
considerably shorter my_vsnprintf() , as my patch demonstrates.  (We
still make sure that the output is NUL-terminated, since this is very
easy to do.)

Attachment: vsnprint.diff
Description: patch against current CVS

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
What I want to find out is -- do parrots know much about Astro-Turf?

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] [PATCH] my_vsnprintf() (PR#606), Gaute B Strokkenes <=