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

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

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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
OLDNEW
1 #include <errno.h> 1 #include <errno.h>
2 #include <string.h> 2 #include <string.h>
3 #include "locale_impl.h" 3 #include "locale_impl.h"
4 #include "libc.h" 4 #include "libc.h"
5 5
6 #define E(a,b) ((unsigned char)a), 6 #define E(a, b) ((unsigned char)a),
7 static const unsigned char errid[] = { 7 static const unsigned char errid[] = {
8 #include "__strerror.h" 8 #include "__strerror.h"
9 }; 9 };
10 10
11 #undef E 11 #undef E
12 #define E(a,b) b "\0" 12 #define E(a, b) b "\0"
13 static const char errmsg[] = 13 static const char errmsg[] =
14 #include "__strerror.h" 14 #include "__strerror.h"
15 ; 15 ;
16 16
17 char *__strerror_l(int e, locale_t loc) 17 char* __strerror_l(int e, locale_t loc) {
18 { 18 const char* s;
19 » const char *s; 19 int i;
20 » int i; 20 /* mips has one error code outside of the 8-bit range due to a
21 » /* mips has one error code outside of the 8-bit range due to a 21 * historical typo, so we just remap it. */
22 » * historical typo, so we just remap it. */ 22 if (EDQUOT == 1133) {
23 » if (EDQUOT==1133) { 23 if (e == 109)
24 » » if (e==109) e=-1; 24 e = -1;
25 » » else if (e==EDQUOT) e=109; 25 else if (e == EDQUOT)
26 » } 26 e = 109;
27 » for (i=0; errid[i] && errid[i] != e; i++); 27 }
28 » for (s=errmsg; i; s++, i--) for (; *s; s++); 28 for (i = 0; errid[i] && errid[i] != e; i++)
29 » return (char *)LCTRANS(s, LC_MESSAGES, loc); 29 ;
30 for (s = errmsg; i; s++, i--)
31 for (; *s; s++)
32 ;
33 return (char*)LCTRANS(s, LC_MESSAGES, loc);
30 } 34 }
31 35
32 char *strerror(int e) 36 char* strerror(int e) {
33 { 37 return __strerror_l(e, CURRENT_LOCALE);
34 » return __strerror_l(e, CURRENT_LOCALE);
35 } 38 }
36 39
37 weak_alias(__strerror_l, strerror_l); 40 weak_alias(__strerror_l, strerror_l);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698