comparison lib/safe-alloc.c @ 17094:67cb7096523b

misc: don't limit commentary to inline functions * lib/binary-io.h, lib/malloca.h, lib/safe-alloc.c: * lib/xalloc-oversized.h, lib/xsize.h: Contrast macros to functions in general, not just to inline functions, when the commentary does not apply only to inline functions.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 27 Aug 2012 22:57:47 -0700
parents 8250f2777afc
children e542fd46ad6f
comparison
equal deleted inserted replaced
17093:d31c977f5af4 17094:67cb7096523b
27 #include <errno.h> 27 #include <errno.h>
28 28
29 29
30 /* Return 1 if an array of N objects, each of size S, cannot exist due 30 /* Return 1 if an array of N objects, each of size S, cannot exist due
31 to size arithmetic overflow. S must be positive and N must be 31 to size arithmetic overflow. S must be positive and N must be
32 nonnegative. This is a macro, not an inline function, so that it 32 nonnegative. This is a macro, not a function, so that it
33 works correctly even when SIZE_MAX < N. 33 works correctly even when SIZE_MAX < N.
34 34
35 By gnulib convention, SIZE_MAX represents overflow in size 35 By gnulib convention, SIZE_MAX represents overflow in size
36 calculations, so the conservative dividend to use here is 36 calculations, so the conservative dividend to use here is
37 SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. 37 SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.