summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b080f5b)
`key' is a loop-invariant so can be tested for NULL once before the
loop. In one case, this also avoid passing NULL to printf(3) for "%s",
and means getcpy()s can be replaced with mh_xstrdup()s.
for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
- if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(key))) {
+ if (!strcasecmp(FENDNULL(np->n_name), key)) {
if (!np->n_context)
inform("bug: context_del(key=\"%s\"), continuing...", np->n_name);
if (pp)
if (!np->n_context)
inform("bug: context_del(key=\"%s\"), continuing...", np->n_name);
if (pp)
for (np = m_defs; np; np = np->n_next)
for (np = m_defs; np; np = np->n_next)
- if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(str)))
+ if (!strcasecmp(FENDNULL(np->n_name), str))
return (np->n_field);
return NULL;
return (np->n_field);
return NULL;
/*
* If list is empty, allocate head of profile/context list.
*/
if (!m_defs) {
NEW(np);
m_defs = np;
/*
* If list is empty, allocate head of profile/context list.
*/
if (!m_defs) {
NEW(np);
m_defs = np;
- np->n_name = getcpy (key);
+ np->n_name = mh_xstrdup(key);
np->n_field = getcpy (value);
np->n_context = 1;
np->n_next = NULL;
np->n_field = getcpy (value);
np->n_context = 1;
np->n_next = NULL;
* this key, and replace its value if found.
*/
for (np = m_defs;; np = np->n_next) {
* this key, and replace its value if found.
*/
for (np = m_defs;; np = np->n_next) {
- if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(key))) {
+ if (!strcasecmp(FENDNULL(np->n_name), key)) {
if (strcmp (value, np->n_field)) {
if (!np->n_context)
inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key, value);
if (strcmp (value, np->n_field)) {
if (!np->n_context)
inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key, value);
*/
NEW(np->n_next);
np = np->n_next;
*/
NEW(np->n_next);
np = np->n_next;
- np->n_name = getcpy (key);
+ np->n_name = mh_xstrdup(key);
np->n_field = getcpy (value);
np->n_context = 1;
np->n_next = NULL;
np->n_field = getcpy (value);
np->n_context = 1;
np->n_next = NULL;
+ header = FENDNULL(header);
for (h = table; h->value; h++)
for (h = table; h->value; h++)
- if (!strcasecmp (FENDNULL(header), FENDNULL(h->value)))
+ if (!strcasecmp(FENDNULL(h->value), header))
return (h - table);
return NOTOK;
return (h - table);
return NOTOK;