[libc-commits] [PATCH] D85059: [libc] Add implementations for isblank, iscntrl, isgraph, ispunct.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 4 11:25:32 PDT 2020


sivachandra added inline comments.


================
Comment at: libc/src/ctype/ctype_utils.h:31
 
+static inline int isalnum(int c) { return isalpha(c) || isdigit(c); }
+
----------------
I should have said said this earlier: seems to me like all the functions in `cytype_utils.h` can take `const unsigned char` argument.


================
Comment at: libc/src/ctype/ctype_utils.h:35
+  const unsigned ch = c;
+  return (ch - 0x21) < 0x5e;
+}
----------------
Wouldn't it read better this way:

```
return 0x20 < ch && ch < 0x7f;
```

Obvious to check that it matches exactly what the standard says.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85059



More information about the libc-commits mailing list