Changes in uspace/lib/c/generic/mem.c [2498b95:1433ecda] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/mem.c
r2498b95 r1433ecda 1 1 /* 2 2 * Copyright (c) 2005 Martin Decky 3 * Copyright (c) 20 18 Jiri Svoboda3 * Copyright (c) 2008 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 252 252 } 253 253 254 /** Search memory area.255 *256 * @param s Memory area257 * @param c Character (byte) to search for258 * @param n Size of memory area in bytes259 *260 * @return Pointer to the first occurrence of @a c in the first @a n261 * bytes of @a s or @c NULL if not found.262 */263 void *memchr(const void *s, int c, size_t n)264 {265 uint8_t *u = (uint8_t *) s;266 unsigned char uc = (unsigned char) c;267 size_t i;268 269 for (i = 0; i < n; i++) {270 if (u[i] == uc)271 return (void *) &u[i];272 }273 274 return NULL;275 }276 277 254 /** @} 278 255 */
Note:
See TracChangeset
for help on using the changeset viewer.