bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] crypto/md5: don't depend on stdint


From: Paul Eggert
Subject: Re: [PATCH] crypto/md5: don't depend on stdint
Date: Fri, 18 Feb 2011 13:16:10 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7

On 02/18/2011 03:13 AM, Bruno Haible wrote:

35 lines of code to define a type md5_uint32, that is only used in
md5.h?

I used 35 lines because that's what glibc uses.  I can easily shrink
it to 8 lines, since we assume C89 or better:

/* Prefer 'unsigned int' for the benefit of typical pre-C99 hosts.  */
#include <limits.h>
#if UINT_MAX == 4294967295u
typedef unsigned int md5_uint32;
#else
# include <stdint.h>
typedef uint32_t md5_uint32;
#endif


Since this is only for Emacs, I'd prefer if these modifications were
stored in the Emacs repository only, as files
   gnulib-local/lib/md5.h.diff
   gnulib-local/lib/md5.c.diff
where they can be automatically be taken into account by gnulib-tool's
--local-dir option.

In the long term it'd be simpler to drop my idea, if the above
8 lines are unacceptably long, and instead just have Emacs start using
stdint now.  That will drag in more stuff than I'd like, and
will cause some problems on the Emacs side (I got complaints
about the stdlib stuff when I imported getloadavg), but perhaps
it'll be doable.

There is a tradeoff here between breaking dependencies, which is
good, and writing clear and clean code to standards, which is
also good.  In this particular case I'm hoping that the benefit
of breaking the dependency is worth the cost of adding 8 lines
or so of code.



reply via email to

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