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

Unified Diff: fusl/src/regex/regerror.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 side-by-side diff with in-line comments
Download patch
Index: fusl/src/regex/regerror.c
diff --git a/fusl/src/regex/regerror.c b/fusl/src/regex/regerror.c
index 5b347cc73c7351b72ec40efa4901818751da7019..24ca3dac61cb4e52238e3a40190d0f49f05dc602 100644
--- a/fusl/src/regex/regerror.c
+++ b/fusl/src/regex/regerror.c
@@ -10,28 +10,31 @@
* data relocations at runtime, 27 Feb 2006. */
static const char messages[] = {
- "No error\0"
- "No match\0"
- "Invalid regexp\0"
- "Unknown collating element\0"
- "Unknown character class name\0"
- "Trailing backslash\0"
- "Invalid back reference\0"
- "Missing ']'\0"
- "Missing ')'\0"
- "Missing '}'\0"
- "Invalid contents of {}\0"
- "Invalid character range\0"
- "Out of memory\0"
- "Repetition not preceded by valid expression\0"
- "\0Unknown error"
-};
+ "No error\0"
+ "No match\0"
+ "Invalid regexp\0"
+ "Unknown collating element\0"
+ "Unknown character class name\0"
+ "Trailing backslash\0"
+ "Invalid back reference\0"
+ "Missing ']'\0"
+ "Missing ')'\0"
+ "Missing '}'\0"
+ "Invalid contents of {}\0"
+ "Invalid character range\0"
+ "Out of memory\0"
+ "Repetition not preceded by valid expression\0"
+ "\0Unknown error"};
-size_t regerror(int e, const regex_t *restrict preg, char *restrict buf, size_t size)
-{
- const char *s;
- for (s=messages; e && *s; e--, s+=strlen(s)+1);
- if (!*s) s++;
- s = LCTRANS_CUR(s);
- return 1+snprintf(buf, size, "%s", s);
+size_t regerror(int e,
+ const regex_t* restrict preg,
+ char* restrict buf,
+ size_t size) {
+ const char* s;
+ for (s = messages; e && *s; e--, s += strlen(s) + 1)
+ ;
+ if (!*s)
+ s++;
+ s = LCTRANS_CUR(s);
+ return 1 + snprintf(buf, size, "%s", s);
}

Powered by Google App Engine
This is Rietveld 408576698