Mercurial > hg > dmlib
comparison src/dmlib.c @ 1166:f29fa5b6b748
Add dmMemset().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Mar 2015 07:36:51 +0200 |
parents | e06abfde6c39 |
children | 132706e3b94b |
comparison
equal
deleted
inserted
replaced
1165:737ae4718c8f | 1166:f29fa5b6b748 |
---|---|
109 /* Check for NULL pointers for portability due to some libc | 109 /* Check for NULL pointers for portability due to some libc |
110 * implementations not handling free(NULL) too well. | 110 * implementations not handling free(NULL) too well. |
111 */ | 111 */ |
112 if (p) free(p); | 112 if (p) free(p); |
113 } | 113 } |
114 | |
115 | |
116 #ifndef DM_HAVE_MEMSET | |
117 void * dmMemset(void *ptr, const int c, size_t n) | |
118 { | |
119 Uint8 *p = (Uint8 *) ptr; | |
120 | |
121 while (n--) | |
122 *p++ = c; | |
123 | |
124 return ptr; | |
125 } | |
126 #endif | |
114 | 127 |
115 | 128 |
116 BOOL dmGetIntVal(const char *s, unsigned int *i) | 129 BOOL dmGetIntVal(const char *s, unsigned int *i) |
117 { | 130 { |
118 if (s[0] == '$') | 131 if (s[0] == '$') |