Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Side by Side Diff: fusl/src/errno/strerror.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/errno/__strerror.h ('k') | fusl/src/exit/_Exit.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <errno.h>
2 #include <string.h>
3 #include "locale_impl.h"
4 #include "libc.h"
5
6 #define E(a,b) ((unsigned char)a),
7 static const unsigned char errid[] = {
8 #include "__strerror.h"
9 };
10
11 #undef E
12 #define E(a,b) b "\0"
13 static const char errmsg[] =
14 #include "__strerror.h"
15 ;
16
17 char *__strerror_l(int e, locale_t loc)
18 {
19 const char *s;
20 int i;
21 /* mips has one error code outside of the 8-bit range due to a
22 * historical typo, so we just remap it. */
23 if (EDQUOT==1133) {
24 if (e==109) e=-1;
25 else if (e==EDQUOT) e=109;
26 }
27 for (i=0; errid[i] && errid[i] != e; i++);
28 for (s=errmsg; i; s++, i--) for (; *s; s++);
29 return (char *)LCTRANS(s, LC_MESSAGES, loc);
30 }
31
32 char *strerror(int e)
33 {
34 return __strerror_l(e, CURRENT_LOCALE);
35 }
36
37 weak_alias(__strerror_l, strerror_l);
OLDNEW
« no previous file with comments | « fusl/src/errno/__strerror.h ('k') | fusl/src/exit/_Exit.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698