MCPcopy Create free account
hub / github.com/coreutils/coreutils / null

Function null

src/expr.c:401–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399/* Return true if V is a null-string or zero-number. */
400
401ATTRIBUTE_PURE
402static bool
403null (VALUE *v)
404{
405 switch (v->type)
406 {
407 case integer:
408 return mpz_sgn (v->u.i) == 0;
409 case string:
410 {
411 char const *cp = v->u.s;
412 if (*cp == '\0')
413 return true;
414
415 cp += (*cp == '-');
416
417 do
418 {
419 if (*cp != '0')
420 return false;
421 }
422 while (*++cp);
423
424 return true;
425 }
426 default:
427 unreachable ();
428 }
429}
430
431/* Return true if CP takes the form of an integer. */
432

Callers 3

mainFunction · 0.85
eval1Function · 0.85
evalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected