| 438 | #define CONN_NOTE "example-hooks-connection" |
| 439 | |
| 440 | static void trace_connection(conn_rec *c, const char *note) |
| 441 | { |
| 442 | const char *trace_copy, *sofar; |
| 443 | char *addon, *where; |
| 444 | void *data; |
| 445 | x_cfg *cfg; |
| 446 | |
| 447 | #if EXAMPLE_LOG_EACH |
| 448 | example_log_each(c->pool, c->base_server, note); |
| 449 | #endif |
| 450 | |
| 451 | cfg = our_cconfig(c); |
| 452 | |
| 453 | where = (cfg != NULL) ? cfg->loc : "nowhere"; |
| 454 | where = (where != NULL) ? where : ""; |
| 455 | |
| 456 | addon = apr_pstrcat(c->pool, |
| 457 | " <li>\n" |
| 458 | " <dl>\n" |
| 459 | " <dt><samp>", note, "</samp></dt>\n" |
| 460 | " <dd><samp>[", where, "]</samp></dd>\n" |
| 461 | " </dl>\n" |
| 462 | " </li>\n", |
| 463 | NULL); |
| 464 | |
| 465 | /* Find existing notes and copy */ |
| 466 | apr_pool_userdata_get(&data, CONN_NOTE, c->pool); |
| 467 | sofar = (data == NULL) ? "" : (const char *) data; |
| 468 | |
| 469 | /* Tack addon onto copy */ |
| 470 | trace_copy = apr_pstrcat(c->pool, sofar, addon, NULL); |
| 471 | |
| 472 | /* |
| 473 | * Stash copy back into pool notes. This call has a cleanup |
| 474 | * parameter, but we're not using it because the string has been |
| 475 | * allocated from that same pool. There is also an unused return |
| 476 | * value: we have nowhere to communicate any error that might |
| 477 | * occur, and will have to check for the existence of this data on |
| 478 | * the other end. |
| 479 | */ |
| 480 | apr_pool_userdata_set((const void *) trace_copy, CONN_NOTE, |
| 481 | NULL, c->pool); |
| 482 | } |
| 483 | |
| 484 | static void trace_nocontext(apr_pool_t *p, const char *file, int line, |
| 485 | const char *note) |
no test coverage detected