[libc-commits] [PATCH] D136421: [libc] Add implementation of fgetc.

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 21 10:26:30 PDT 2022


michaelrj accepted this revision.
michaelrj added a comment.
This revision is now accepted and ready to land.

LGTM with nits



================
Comment at: libc/src/stdio/fgetc.cpp:18
+  char c;
+  ssize_t r = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1);
+  if (r != 1) {
----------------
this should be `size_t` not `ssize_t`


================
Comment at: libc/src/stdio/fgetc.cpp:19
+  ssize_t r = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1);
+  if (r != 1) {
+    return EOF;
----------------
nit: you don't need the braces here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136421/new/

https://reviews.llvm.org/D136421



More information about the libc-commits mailing list