/** * @brief Frees an article or a table of articles. * @luaparam LuaArticle article to free * @luafunc rm( LuaArticle ) */ int newsL_rm( lua_State *L ) { LuaArticle *Larticle; if (lua_istable(L, 1)) { lua_pushnil(L); while (lua_next(L, -2)) { Larticle = luaL_validarticle(L, -1); free_article(*Larticle); lua_pop(L, 1); } } else { Larticle = luaL_validarticle(L, 1); free_article(*Larticle); } /* If we're landed, we should regenerate the news buffer. */ if (landed) { generate_news(faction_name(land_planet->faction)); if (land_loaded) { bar_regen(); } } return 1; }
void free_article_array(struct article **a) { int i; for(i = 0; a[i] != NULL; i++) free_article(a[i]); free(a); }