<!DOCTYPE html>
<!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;">
On 30 Oct 2026, Kris Van Hees told this: Is it really worth replacing sscanf(), which though it's a bit clunky is at least used by other people, with even more hand-rolled parsing code? The hex parser isn't too bad, but this: > +static int</div>
<!-- Preheader Text : END -->

<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;"></div>
<!-- Email Banner : END -->

<!-- BaNnErBlUrFlE-BoDy-end -->
<html>
<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
  #pfptBannerh2a4ebr { all: revert !important; display: block !important;
    visibility: visible !important; opacity: 1 !important;
    background-color: #c2d4d4 !important;
    max-width: none !important; max-height: none !important }
  .pfptPrimaryButtonh2a4ebr:hover, .pfptPrimaryButtonh2a4ebr:focus {
    background-color: #a2b1b1 !important; }
  .pfptPrimaryButtonh2a4ebr:active {
    background-color: #828e8e !important; }
  html:root, html:root>body { all: revert !important; display: block !important;
    visibility: visible !important; opacity: 1 !important; }
</style>

<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><body><pre style="font-family: sans-serif; font-size: 100%; white-space: pre-wrap; word-wrap: break-word">On 30 Oct 2026, Kris Van Hees told this:

Is it really worth replacing sscanf(), which though it's a bit clunky is
at least used by other people, with even more hand-rolled parsing code?
The hex parser isn't too bad, but this:

> +static int
> +dt_modsym_parse(const char *line, int kind, dt_kallsym_t *sym)
> +{
> +  const char *end;
> +  uint64_t value;
> +  size_t len;
> +
> +  if (dt_modsym_hex(&line, &value) != 0)
> +          return -1;
> +  sym->addr = value;
> +  sym->size = 1;
> +  if (kind == DT_MODSYM_KALLMODSYMS) {
> +          if (dt_modsym_hex(&line, &value) != 0 || value > SIZE_MAX)
> +                  return -1;
> +          sym->size = value;
> +  }
> +  while (isspace((unsigned char)*line))
> +          line++;
> +  if (*line == '\0')
> +          return -1;
> +  sym->type = *line++;
> +  if (!isspace((unsigned char)*line))
> +          return -1;
> +  while (isspace((unsigned char)*line))
> +          line++;
> +  len = strcspn(line, " \t\r\n");
> +  if (len == 0 || len >= sizeof(sym->name))
> +          return -1;
> +  memcpy(sym->name, line, len);
> +  sym->name[len] = '\0';
> +  line += len;
> +  while (isspace((unsigned char)*line))
> +          line++;
> +  if (*line == '\0') {
> +          strcpy(sym->mod, "vmlinux");
> +          return 0;
> +  }
> +  if (*line++ != '[' || (end = strchr(line, ']')) == NULL)
> +          return -1;
> +  len = end - line;
> +  if (len == 0 || len >= sizeof(sym->mod))
> +          return -1;
> +  memcpy(sym->mod, line, len);
> +  sym->mod[len] = '\0';
> +  return 1;               /* Explicit module name(s). */
> +}

... strikes me as exactly the sort of thing you should never ever do as
root.

Is sscanf() really noticable in profiles? (I guess it might be: we are
calling it hundreds of thousands of times, after all...)

-- 
NULL && (void)
</pre></body></html>