Permalink
Browse files

Removed unused awesomewm functions from luah.c

  • Loading branch information...
1 parent 133677a commit 9f747e97da2d392f2e98d00f3a67ee8343d25fff @mason-larobina mason-larobina committed Mar 22, 2012
Showing with 0 additions and 89 deletions.
  1. +0 −87 luah.c
  2. +0 −2 luah.h
View
87 luah.c
@@ -229,93 +229,6 @@ luaH_fixups(lua_State *L)
lua_settable(L, LUA_GLOBALSINDEX);
}
-/* Look for an item: table, function, etc.
- * \param L The Lua VM state.
- * \param item The pointer item.
- */
-gboolean
-luaH_hasitem(lua_State *L, gconstpointer item)
-{
- lua_pushnil(L);
- while(luaH_mtnext(L, -2)) {
- if(lua_topointer(L, -1) == item) {
- /* remove value and key */
- lua_pop(L, 2);
- return TRUE;
- }
- if(lua_istable(L, -1))
- if(luaH_hasitem(L, item)) {
- /* remove key and value */
- lua_pop(L, 2);
- return TRUE;
- }
- /* remove value */
- lua_pop(L, 1);
- }
- return FALSE;
-}
-
-/* Browse a table pushed on top of the index, and put all its table and
- * sub-table ginto an array.
- * \param L The Lua VM state.
- * \param elems The elements array.
- * \return False if we encounter an elements already in list.
- */
-static gboolean
-luaH_isloop_check(lua_State *L, GPtrArray *elems)
-{
- if(lua_istable(L, -1)) {
- gconstpointer object = lua_topointer(L, -1);
-
- /* Check that the object table is not already in the list */
- for(guint i = 0; i < elems->len; i++)
- if(elems->pdata[i] == object)
- return FALSE;
-
- /* push the table in the elements list */
- g_ptr_array_add(elems, (gpointer) object);
-
- /* look every object in the "table" */
- lua_pushnil(L);
- while(luaH_mtnext(L, -2)) {
- if(!luaH_isloop_check(L, elems)) {
- /* remove key and value */
- lua_pop(L, 2);
- return FALSE;
- }
- /* remove value, keep key for next iteration */
- lua_pop(L, 1);
- }
- }
- return TRUE;
-}
-
-/* Check if a table is a loop. When using tables as direct acyclic digram,
- * this is useful.
- * \param L The Lua VM state.
- * \param idx The index of the table in the stack
- * \return True if the table loops.
- */
-gboolean
-luaH_isloop(lua_State *L, gint idx)
-{
- /* elems is an elements array that we will fill with all array we
- * encounter while browsing the tables */
- GPtrArray *elems = g_ptr_array_new();
-
- /* push table on top */
- lua_pushvalue(L, idx);
-
- gboolean ret = luaH_isloop_check(L, elems);
-
- /* remove pushed table */
- lua_pop(L, 1);
-
- g_ptr_array_free(elems, TRUE);
-
- return !ret;
-}
-
static gint
luaH_panic(lua_State *L)
{
View
2 luah.h
@@ -158,9 +158,7 @@ luaH_rawfield(lua_State *L, gint idx, const gchar *field)
void luaH_init();
gboolean luaH_parserc(const gchar *, gboolean);
-gboolean luaH_hasitem(lua_State *, gconstpointer);
gint luaH_mtnext(lua_State *, gint);
-gboolean luaH_isloop(lua_State *, gint);
gint luaH_class_index_miss_property(lua_State *, lua_object_t *);
gint luaH_class_newindex_miss_property(lua_State *, lua_object_t *);

0 comments on commit 9f747e9

Please sign in to comment.