MCPcopy Create free account
hub / github.com/apache/httpd / check_macro_contents

Function check_macro_contents

modules/core/mod_macro.c:489–526  ·  view source on GitHub ↗

warn if some macro arguments are not used. */

Source from the content-addressed store, hash-verified

487 warn if some macro arguments are not used.
488*/
489static const char *check_macro_contents(apr_pool_t * pool,
490 const ap_macro_t * macro)
491{
492 int nelts = macro->arguments->nelts;
493 char **names = (char **) macro->arguments->elts;
494 apr_array_header_t *used;
495 int i;
496 const char *errmsg;
497
498 if (macro->contents->nelts == 0) {
499 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, APLOGNO(02799)
500 "macro '%s' (%s): empty contents!",
501 macro->name, macro->location);
502 return NULL; /* no need to further warnings... */
503 }
504
505 used = apr_array_make(pool, nelts, sizeof(char));
506
507 for (i = 0; i < nelts; i++) {
508 used->elts[i] = 0;
509 }
510
511 errmsg = process_content(pool, macro, macro->arguments, used, NULL);
512
513 if (errmsg) {
514 return errmsg;
515 }
516
517 for (i = 0; i < nelts; i++) {
518 if (!used->elts[i]) {
519 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, APLOGNO(02800)
520 "macro '%s' (%s): argument '%s' (#%d) never used",
521 macro->name, macro->location, names[i], i + 1);
522 }
523 }
524
525 return NULL;
526}
527
528
529/************************************************** MACRO PSEUDO CONFIG FILE */

Callers 1

macro_sectionFunction · 0.85

Calls 2

process_contentFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected