<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115394>115394</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc] Clean up unnecessary function pointers in scanf
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          michaelrj-google
      </td>
    </tr>
</table>

<pre>
    The scanf reader is the abstraction that scanf uses to read from either a file or a string, similar to printf's writer. Unlike printf, however, there are only two variants of scanf: `fscanf` and `sscanf` (just `scanf` is the same as `fscanf(stdin, ...)`). This means that the `stream_getc` and `stream_ungetc` functions don't need to be pointers, they can be declared with `using` statements based on the current platform.

Files you'll need to edit:
[libc/src/stdio/scanf_core/vfscanf_internal.h](https://github.com/llvm/llvm-project/blob/main/libc/src/stdio/scanf_core/vfscanf_internal.h)
[libc/src/stdio/scanf_core/reader.h](https://github.com/llvm/llvm-project/blob/main/libc/src/stdio/scanf_core/reader.h)

What to do:
Move the definitions of `getc` and `ungetc` in `vfscanf_internal` into `reader.h` (along with the associated `#if defined` logic for each target).
Define the `stream_getc` and `stream_ungetc` functions with `using` statements inside of `class Reader` (or do something equivalent).
Clean up the relevant code.

If you have questions or need help, feel free to comment on this issue or reach out via the LLVM discord.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU2P3DYM_TWaCxHDlufz4EOyiwEKJJcibY8LWqJtbWVpItKz2H9fSJ6dbHMokBx6kW1KIh-f3rOQ2Y2BqFO7T2r3uMFFppi62ZkJyafnD2OMo6dNH-1r93UiYINhgERoKYFjkIkAe5aERlwMIBPKbdHCxCCxLIYhxRnIyUQJEAbnCWJ-Y0kujEo_ALvZeUx5xyW5IIPSB4aX5IRSBX8E7_6m-8wDTPGFrpTya05KgIkgBv8K8hLhislhEIY4rGhU-xHUvh7Wj30NGG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