[libc-commits] [PATCH] D122327: [libc] Add implementations of fopen, flose, fread, fwrite and fseek.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Mar 23 16:40:16 PDT 2022


sivachandra added inline comments.


================
Comment at: libc/src/stdio/fopen.h:16
 
-struct FILE {
-  mtx_t lock;
-
-  using write_function_t = size_t(FILE *, const char *, size_t);
-
-  write_function_t *write;
-};
+::FILE *fopen(const char *__restrict name, const char *__restrict mode);
 
----------------
michaelrj wrote:
> why does this need to specifically be a global namespace FILE?
To make it absolutely clear that we are indeed referring to the public `FILE` type and not one in the namespace `__llvm_libc`. We don't have one in `__llvm_libc`, but qualification makes it clear.


================
Comment at: libc/src/stdio/fseek.h:16
 
-struct FILE {
-  mtx_t lock;
-
-  using write_function_t = size_t(FILE *, const char *, size_t);
-
-  write_function_t *write;
-};
+int fseek(FILE *stream, long offset, int whence);
 
----------------
michaelrj wrote:
> the other FILEs are specifically global, if that is necessary then this one should be too.
Add `::` to all references to `FILE` in `src/stdio`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122327



More information about the libc-commits mailing list