summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShmuel Zeigerman <solomuz0@gmail.com>2012-01-07 01:00:08 +0200
committerShmuel Zeigerman <solomuz0@gmail.com>2012-01-07 01:00:08 +0200
commit647047de01d262b4d0c8c66172efd0fba07b5ce8 (patch)
treeb5ff607b451e753d428db632b54c43e5aa614eea
parent7836c34663ca4ae78b0e39913cb5a5f5f37c2024 (diff)
downloadlrexlib-647047de01d262b4d0c8c66172efd0fba07b5ce8.tar.gz
Tidy up
-rw-r--r--src/oniguruma/lonig.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/oniguruma/lonig.c b/src/oniguruma/lonig.c
index e0a4acd..d3cdfcc 100644
--- a/src/oniguruma/lonig.c
+++ b/src/oniguruma/lonig.c
@@ -174,19 +174,14 @@ static int fcmp(const void *p1, const void *p2) {
}
static const char *getlocale (lua_State *L, int pos) {
- EncPair key;
+ EncPair key, *found;
if ((key.name = luaL_optstring(L, pos, NULL)) == NULL)
return (const char*)ONIG_ENCODING_ASCII;
- else {
- EncPair *pair = (EncPair*) bsearch(&key, Encodings,
- sizeof(Encodings)/sizeof(EncPair), sizeof(EncPair), fcmp);
- if (pair != NULL)
- return (const char*)pair->value;
- else {
- luaL_argerror(L, pos, "invalid or unsupported encoding string");
- return NULL;
- }
- }
+ found = (EncPair*) bsearch(&key, Encodings, sizeof(Encodings)/sizeof(EncPair),
+ sizeof(EncPair), fcmp);
+ if (found == NULL)
+ luaL_argerror(L, pos, "invalid or unsupported encoding string");
+ return (const char*)found->value;
}
static void *getsyntax (lua_State *L, int pos) {
@@ -194,7 +189,7 @@ static void *getsyntax (lua_State *L, int pos) {
if ((key.name = luaL_optstring(L, pos, NULL)) == NULL)
return ONIG_SYNTAX_DEFAULT;
found = (EncPair*) bsearch(&key, Syntaxes, sizeof(Syntaxes)/sizeof(EncPair),
- sizeof(EncPair), fcmp);
+ sizeof(EncPair), fcmp);
if (found == NULL)
luaL_argerror(L, pos, "invalid or unsupported syntax string");
return found->value;