"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib-dict/dict-iter-lua.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

dict-iter-lua.c  (dovecot-2.3.16):dict-iter-lua.c  (dovecot-2.3.17)
skipping to change at line 144 skipping to change at line 144
/* dict iter callback */ /* dict iter callback */
static void lua_dict_iterate_callback(struct lua_dict_iter *iter) static void lua_dict_iterate_callback(struct lua_dict_iter *iter)
{ {
if (iter->yielded) if (iter->yielded)
return; return;
iter->yielded = TRUE; iter->yielded = TRUE;
dlua_pcall_yieldable_resume(iter->L, 1); dlua_pcall_yieldable_resume(iter->L, 1);
} }
/* /*
* Iterate a dict at key [-3,+2,e] * Iterate a dict at key [-(3|4),+2,e]
* *
* Args: * Args:
* 1) userdata: sturct dict *dict * 1) userdata: sturct dict *dict
* 2) string: key * 2) string: key
* 3) integer: flags * 3) integer: flags
* 4*) string: username
* *
* Returns: * Returns:
* Returns a iteration step function and dict iter userdata. * Returns a iteration step function and dict iter userdata.
* Username will be NULL if not provided in args.
*/ */
int lua_dict_iterate(lua_State *L) int lua_dict_iterate(lua_State *L)
{ {
enum dict_iterate_flags flags; enum dict_iterate_flags flags;
struct lua_dict_iter *iter; struct lua_dict_iter *iter;
struct dict *dict; struct dict *dict;
const char *path; const char *path, *username = NULL;
pool_t pool; pool_t pool;
DLUA_REQUIRE_ARGS(L, 3); DLUA_REQUIRE_ARGS_IN(L, 3, 4);
dict = dlua_check_dict(L, 1); dict = dlua_check_dict(L, 1);
path = luaL_checkstring(L, 2); path = luaL_checkstring(L, 2);
flags = luaL_checkinteger(L, 3); flags = luaL_checkinteger(L, 3);
if (lua_gettop(L) >= 4)
username = luaL_checkstring(L, 4);
struct dict_op_settings set = {
.username = username,
};
/* set up iteration */ /* set up iteration */
pool = pool_alloconly_create("lua dict iter", 128); pool = pool_alloconly_create("lua dict iter", 128);
iter = p_new(pool, struct lua_dict_iter, 1); iter = p_new(pool, struct lua_dict_iter, 1);
iter->pool = pool; iter->pool = pool;
iter->iter = dict_iterate_init(dict, path, flags | iter->iter = dict_iterate_init(dict, &set, path, flags |
DICT_ITERATE_FLAG_ASYNC); DICT_ITERATE_FLAG_ASYNC);
p_array_init(&iter->refs, iter->pool, 32); p_array_init(&iter->refs, iter->pool, 32);
iter->L = L; iter->L = L;
dict_iterate_set_async_callback(iter->iter, dict_iterate_set_async_callback(iter->iter,
lua_dict_iterate_callback, iter); lua_dict_iterate_callback, iter);
/* push return values: func, state */ /* push return values: func, state */
lua_pushcfunction(L, lua_dict_iterate_step); lua_pushcfunction(L, lua_dict_iterate_step);
xlua_pushdict_iter(L, iter, FALSE); xlua_pushdict_iter(L, iter, FALSE);
 End of changes. 7 change blocks. 
4 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)