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

Function process_content

modules/core/mod_macro.c:450–484  ·  view source on GitHub ↗

perform substitutions in a macro contents and return the result as a newly allocated array, if result is defined. may also return an error message. passes used down to substitute_macro_args. */

Source from the content-addressed store, hash-verified

448 passes used down to substitute_macro_args.
449*/
450static const char *process_content(apr_pool_t * pool,
451 const ap_macro_t * macro,
452 const apr_array_header_t * replacements,
453 apr_array_header_t * used,
454 apr_array_header_t ** result)
455{
456 apr_array_header_t *contents = macro->contents;
457 char line[MAX_STRING_LEN];
458 int i;
459
460 if (result) {
461 *result = apr_array_make(pool, contents->nelts, sizeof(char *));
462 }
463
464 /* for each line of the macro body */
465 for (i = 0; i < contents->nelts; i++) {
466 const char *errmsg;
467 /* copy the line and substitute macro parameters */
468 apr_cpystrn(line, ((char **) contents->elts)[i], MAX_STRING_LEN);
469 errmsg = substitute_macro_args(line, MAX_STRING_LEN,
470 macro, replacements, used);
471 if (errmsg) {
472 return apr_psprintf(pool,
473 "while processing line %d of macro '%s' (%s) %s",
474 i + 1, macro->name, macro->location, errmsg);
475 }
476 /* append substituted line to result array */
477 if (result) {
478 char **new = apr_array_push(*result);
479 *new = apr_pstrdup(pool, line);
480 }
481 }
482
483 return NULL;
484}
485
486/*
487 warn if some macro arguments are not used.

Callers 2

check_macro_contentsFunction · 0.85
use_macroFunction · 0.85

Calls 1

substitute_macro_argsFunction · 0.85

Tested by

no test coverage detected