Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
map<string, bufferlist> kvpairs;
- lua_pushnil(L);
- while (lua_next(L, 1) != 0) {
+ for (lua_pushnil(L); lua_next(L, 1); lua_pop(L, 1)) {
/*
* In the case of a numeric key a copy is made on the stack because
* converting to a string would otherwise manipulate the original key and
}
kvpairs[key] = val;
-
- lua_pop(L, 1);
}
int ret = cls_cxx_map_set_vals(hctx, &kvpairs);
/* fill in return value */
mds_rank_t it = mds_rank_t(0);
- lua_pushnil(L);
- while (lua_next(L, -2) != 0) {
+ for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
if (!lua_isnumber(L, -1)) {
dout(0) << "WARNING: mantle script returned a malformed response" << dendl;
lua_close(L);
return -EINVAL;
}
my_targets[it] = (lua_tonumber(L, -1));
- lua_pop(L, 1);
it++;
}