MCPcopy Create free account
hub / github.com/F-Stack/f-stack / resource_string_copy

Function resource_string_copy

freebsd/kern/subr_hints.c:403–421  ·  view source on GitHub ↗

* This is a bit nasty, but allows us to not modify the env strings. */

Source from the content-addressed store, hash-verified

401 * This is a bit nasty, but allows us to not modify the env strings.
402 */
403static const char *
404resource_string_copy(const char *s, int len)
405{
406 static char stringbuf[256];
407 static int offset = 0;
408 const char *ret;
409
410 if (len == 0)
411 len = strlen(s);
412 if (len > 255)
413 return NULL;
414 if ((offset + len + 1) > 255)
415 offset = 0;
416 bcopy(s, &stringbuf[offset], len);
417 stringbuf[offset + len] = '\0';
418 ret = &stringbuf[offset];
419 offset += len + 1;
420 return ret;
421}
422
423/*
424 * err = resource_find_match(&anchor, &name, &unit, resname, value)

Callers 1

resource_find_matchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected