Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/modules/luapmf check parameters
details: https://anonhg.NetBSD.org/src/rev/197a1fa577de
branches: trunk
changeset: 790978:197a1fa577de
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Tue Oct 29 09:18:45 2013 +0000
description:
check parameters
diffstat:
sys/modules/luapmf/luapmf.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diffs (54 lines):
diff -r 6e3da9bd1040 -r 197a1fa577de sys/modules/luapmf/luapmf.c
--- a/sys/modules/luapmf/luapmf.c Tue Oct 29 08:34:07 2013 +0000
+++ b/sys/modules/luapmf/luapmf.c Tue Oct 29 09:18:45 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: luapmf.c,v 1.1 2013/10/28 20:06:05 mbalmer Exp $ */
+/* $NetBSD: luapmf.c,v 1.2 2013/10/29 09:18:45 mbalmer Exp $ */
/*
* Copyright (c) 2011, 2013 Marc Balmer <mbalmer%NetBSD.org@localhost>.
@@ -46,11 +46,7 @@
static int
system_shutdown(lua_State *L)
{
- int howto;
-
- howto = lua_tointeger(L, 1);
- printf("calling pmf_shutdown_system with howto %02x\n", howto);
- pmf_system_shutdown(howto);
+ pmf_system_shutdown(lua_tointeger(L, 1));
return 0;
}
@@ -61,10 +57,8 @@
key = lua_tostring(L, -2);
value = lua_tostring(L, -1);
- if (key != NULL && value != NULL) {
- printf("pmf_set_platform(%s, %s)\n", key, value);
+ if (key != NULL && value != NULL)
pmf_set_platform(key, value);
- }
return 0;
}
@@ -74,10 +68,16 @@
const char *key, *value;
key = lua_tostring(L, -1);
- value = pmf_get_platform(key);
- printf("pmf_get_platform(%s) = %s\n", key, value);
- lua_pushstring(L, value);
+ if (key != NULL) {
+ value = pmf_get_platform(key);
+ if (value != NULL)
+ lua_pushstring(L, value);
+ else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
return 1;
+
}
struct pmf_reg {
Home |
Main Index |
Thread Index |
Old Index