MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / tokcpy0

Function tokcpy0

util/segstring.c:382–391  ·  view source on GitHub ↗

SAFE tokcpy() WHICH GUARANTEES A C STRING. WILL TRUNCATE TOKEN IF * NECESSARY. */

Source from the content-addressed store, hash-verified

380/* SAFE tokcpy() WHICH GUARANTEES A C STRING. WILL TRUNCATE TOKEN IF
381 * NECESSARY. */
382char *tokcpy0(const char *tok, size_t ltok, char *dest, size_t ldest)
383{
384 if (ldest == 0 || !dest || !tok)
385 return NULL;
386 if (ltok >= ldest)
387 ltok = ldest - 1;
388 memcpy(dest, tok, ltok);
389 dest[ltok] = 0;
390 return dest;
391}
392
393#ifdef SEGSTRING_TESTDRIVER
394

Callers 4

bdb_process_user_commandFunction · 0.85
read_lrl_optionFunction · 0.85
reqlog_process_messageFunction · 0.85
process_message.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected