1 /* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation, version 2. 6 7 This program is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 GNU General Public License for more details. 11 12 You should have received a copy of the GNU General Public License 13 along with this program; if not, write to the Free Software Foundation, 14 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 15 16 #ifndef LIB_SYSTEM_H 17 #define LIB_SYSTEM_H 1 18 19 #include <stddef.h> 20 #include <stdint.h> 21 22 extern void *xmalloc (size_t) __attribute__ ((__malloc__)); 23 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__)); 24 extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__)); 25 26 extern char *xstrdup (const char *) __attribute__ ((__malloc__)); 27 extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__)); 28 29 30 extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len); 31 32 33 /* A special gettext function we use if the strings are too short. */ 34 #define sgettext(Str) \ 35 ({ const char *__res = strrchr (gettext (Str), '|'); \ 36 __res ? __res + 1 : Str; }) 37 38 #define gettext_noop(Str) Str 39 40 #endif /* system.h */ 41