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.