we compute the object signature from the fieldlist_str and the printf_str of the LogFormat rather than from the format_str because the format_str is not part of a LogBuffer header
| 275 | // is not part of a LogBuffer header |
| 276 | // |
| 277 | uint64_t |
| 278 | LogObject::compute_signature(LogFormat *format, char *filename, unsigned int flags) |
| 279 | { |
| 280 | std::string_view filename_sv{filename}; |
| 281 | if (filename_sv == "stdout" || filename_sv == "stderr") { |
| 282 | return 0; |
| 283 | } |
| 284 | char *fl = format->fieldlist(); |
| 285 | char *ps = format->printf_str(); |
| 286 | uint64_t signature = 0; |
| 287 | |
| 288 | if (fl && ps && filename) { |
| 289 | int buf_size = strlen(fl) + strlen(ps) + strlen(filename) + 2; |
| 290 | char *buffer = static_cast<char *>(ats_malloc(buf_size)); |
| 291 | |
| 292 | ink_string_concatenate_strings(buffer, fl, ps, filename, |
| 293 | flags & LogObject::BINARY ? "B" : (flags & LogObject::WRITES_TO_PIPE ? "P" : "A"), NULL); |
| 294 | |
| 295 | CryptoHash hash; |
| 296 | CryptoContext().hash_immediate(hash, buffer, buf_size - 1); |
| 297 | signature = hash.fold(); |
| 298 | |
| 299 | ats_free(buffer); |
| 300 | } |
| 301 | return signature; |
| 302 | } |
| 303 | |
| 304 | void |
| 305 | LogObject::display(FILE *fd) |
nothing calls this directly
no test coverage detected