OLD | NEW |
1 /* $Id: util.h 2273 2010-01-13 04:44:28Z peter $ | 1 /* |
2 * YASM utility functions. | 2 * YASM utility functions. |
3 * | 3 * |
4 * Includes standard headers and defines prototypes for replacement functions | 4 * Includes standard headers and defines prototypes for replacement functions |
5 * if needed. | 5 * if needed. |
6 * | 6 * |
7 * Copyright (C) 2001-2007 Peter Johnson | 7 * Copyright (C) 2001-2007 Peter Johnson |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
11 * are met: | 11 * are met: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 # define yasm__strncasecmp(x, y, n) _strnicmp(x, y, n) | 112 # define yasm__strncasecmp(x, y, n) _strnicmp(x, y, n) |
113 #elif HAVE_STRCMPI | 113 #elif HAVE_STRCMPI |
114 # define yasm__strcasecmp(x, y) strcmpi(x, y) | 114 # define yasm__strcasecmp(x, y) strcmpi(x, y) |
115 # define yasm__strncasecmp(x, y, n) strncmpi(x, y, n) | 115 # define yasm__strncasecmp(x, y, n) strncmpi(x, y, n) |
116 #else | 116 #else |
117 # define USE_OUR_OWN_STRCASECMP | 117 # define USE_OUR_OWN_STRCASECMP |
118 #endif | 118 #endif |
119 | 119 |
120 #include <libyasm/compat-queue.h> | 120 #include <libyasm/compat-queue.h> |
121 | 121 |
122 #ifdef HAVE_SYS_CDEFS_H | |
123 # include <sys/cdefs.h> | |
124 #endif | |
125 | |
126 #ifdef __RCSID | |
127 # define RCSID(s) __RCSID(s) | |
128 #elif defined(__GNUC__) && defined(__ELF__) | |
129 # define RCSID(s) __asm__(".ident\t\"" s "\"") | |
130 #else | |
131 # define RCSID(s) static const char rcsid[] = s | |
132 #endif | |
133 | |
134 #ifdef WITH_DMALLOC | 122 #ifdef WITH_DMALLOC |
135 # include <dmalloc.h> | 123 # include <dmalloc.h> |
136 # define yasm__xstrdup(str) xstrdup(str) | 124 # define yasm__xstrdup(str) xstrdup(str) |
137 # define yasm_xmalloc(size) xmalloc(size) | 125 # define yasm_xmalloc(size) xmalloc(size) |
138 # define yasm_xcalloc(count, size) xcalloc(count, size) | 126 # define yasm_xcalloc(count, size) xcalloc(count, size) |
139 # define yasm_xrealloc(ptr, size) xrealloc(ptr, size) | 127 # define yasm_xrealloc(ptr, size) xrealloc(ptr, size) |
140 # define yasm_xfree(ptr) xfree(ptr) | 128 # define yasm_xfree(ptr) xfree(ptr) |
141 #endif | 129 #endif |
142 | 130 |
143 /* Bit-counting: used primarily by HAMT but also in a few other places. */ | 131 /* Bit-counting: used primarily by HAMT but also in a few other places. */ |
(...skipping 18 matching lines...) Expand all Loading... |
162 #ifndef NELEMS | 150 #ifndef NELEMS |
163 /** Get the number of elements in an array. | 151 /** Get the number of elements in an array. |
164 * \internal | 152 * \internal |
165 * \param array array | 153 * \param array array |
166 * \return Number of elements. | 154 * \return Number of elements. |
167 */ | 155 */ |
168 #define NELEMS(array) (sizeof(array) / sizeof(array[0])) | 156 #define NELEMS(array) (sizeof(array) / sizeof(array[0])) |
169 #endif | 157 #endif |
170 | 158 |
171 #endif | 159 #endif |
OLD | NEW |