[asterisk-commits] mnicholson: testsuite/asterisk/trunk r642 - /asterisk/trunk/asttest/lib/lua/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 29 12:06:43 CDT 2010


Author: mnicholson
Date: Thu Jul 29 12:06:40 2010
New Revision: 642

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=642
Log:
Don't push the test name onto the stack when retrieving it

Modified:
    asterisk/trunk/asttest/lib/lua/testlib.c

Modified: asterisk/trunk/asttest/lib/lua/testlib.c
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/testlib.c?view=diff&rev=642&r1=641&r2=642
==============================================================================
--- asterisk/trunk/asttest/lib/lua/testlib.c (original)
+++ asterisk/trunk/asttest/lib/lua/testlib.c Thu Jul 29 12:06:40 2010
@@ -52,9 +52,12 @@
  * \brief Push the current test's name on the stack and return a pointer to it.
  * \param L the lua state to use
  */
-static const char *push_test_name(lua_State *L) {
+static const char *get_test_name(lua_State *L) {
+	const char *c;
 	lua_getfield(L, LUA_REGISTRYINDEX, "testlib_name");
-	return lua_tostring(L, -1);
+	c = lua_tostring(L, -1);
+	lua_pop(L, 1);
+	return c;
 }
 
 /*
@@ -64,7 +67,7 @@
 static int lua_ts_log(lua_State *L) {
 	const char *string = luaL_checkstring(L, 1);
 	struct testsuite *ts = push_ts(L);
-	const char *name = push_test_name(L);
+	const char *name = get_test_name(L);
 
 	ts_log(ts, name, "%s", string);
 




More information about the asterisk-commits mailing list