util.c
changeset 72 d049c92d0809
parent 0 65cbecad22b4
child 128 8692a6fbe415
--- a/util.c	Mon Apr 27 12:51:53 2009 +0300
+++ b/util.c	Thu May 21 00:13:26 2009 +0300
@@ -1,5 +1,20 @@
 
-#include <glib.h>	// g_ascii_strcasecmp
+/* Copyright 2009 Myhailo Danylenko
+
+This code is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include <strings.h>
 #include <lua.h>
 #include <lauxlib.h>
 
@@ -8,7 +23,7 @@
 enum_value_t string2enum (const char *string, const string2enum_t *set)
 {
 	while (set->string) {
-		if (!g_ascii_strcasecmp (string, set->string))
+		if (!strcasecmp (string, set->string))
 			return set->value;
 		++set;
 	}
@@ -80,6 +95,7 @@
 				luaL_argerror (L, index, "wrong key type of flags table");
 			lua_pop (L, 1);
 		}
+		return retval;
 	} else
 		luaL_argerror (L, index, "integer, string, or table of ones expected");
 	return 0; // never happens