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

Side by Side Diff: fusl/src/regex/regerror.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/regex/regcomp.c ('k') | fusl/src/regex/regexec.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 <string.h>
2 #include <regex.h>
3 #include <stdio.h>
4 #include "locale_impl.h"
5
6 /* Error message strings for error codes listed in `regex.h'. This list
7 needs to be in sync with the codes listed there, naturally. */
8
9 /* Converted to single string by Rich Felker to remove the need for
10 * data relocations at runtime, 27 Feb 2006. */
11
12 static const char messages[] = {
13 "No error\0"
14 "No match\0"
15 "Invalid regexp\0"
16 "Unknown collating element\0"
17 "Unknown character class name\0"
18 "Trailing backslash\0"
19 "Invalid back reference\0"
20 "Missing ']'\0"
21 "Missing ')'\0"
22 "Missing '}'\0"
23 "Invalid contents of {}\0"
24 "Invalid character range\0"
25 "Out of memory\0"
26 "Repetition not preceded by valid expression\0"
27 "\0Unknown error"
28 };
29
30 size_t regerror(int e, const regex_t *restrict preg, char *restrict buf, size_t size)
31 {
32 const char *s;
33 for (s=messages; e && *s; e--, s+=strlen(s)+1);
34 if (!*s) s++;
35 s = LCTRANS_CUR(s);
36 return 1+snprintf(buf, size, "%s", s);
37 }
OLDNEW
« no previous file with comments | « fusl/src/regex/regcomp.c ('k') | fusl/src/regex/regexec.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698