httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r1469744 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_request.c modules/lua/lua_request.h
Date Fri, 19 Apr 2013 09:02:33 GMT


humbedooh@apache.org wrote:
> Author: humbedooh
> Date: Fri Apr 19 08:46:28 2013
> New Revision: 1469744
> 
> URL: http://svn.apache.org/r1469744
> Log:
> Remove lua_ap_banner, as it's no longer being used.
> Add ivm_get/ivm_set for Inter-VM data transfer. This allows multiple VMs across a process
to share data without having to resort to external databases or filesystems. This is a work
in progress, and I have yet to work out a proper way of resetting a variable without causing
a memory leak (this could be done by allocating a new pool for each object, but I'm trying
to see if there's a more efficient way). Comments, ideas etc are most welcome.
> 
> Modified:
>     httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
>     httpd/httpd/trunk/modules/lua/lua_request.c
>     httpd/httpd/trunk/modules/lua/lua_request.h
> 

> Modified: httpd/httpd/trunk/modules/lua/lua_request.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=1469744&r1=1469743&r2=1469744&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/lua/lua_request.c (original)
> +++ httpd/httpd/trunk/modules/lua/lua_request.c Fri Apr 19 08:46:28 2013

> @@ -1665,6 +1661,49 @@ static int req_debug(lua_State *L)
>      return req_log_at(L, APLOG_DEBUG);
>  }
>  
> +static int lua_ivm_get(lua_State *L) {
> +    const char *key, *raw_key;
> +    lua_ivm_object *object = NULL;
> +    request_rec *r = ap_lua_check_request_rec(L, 1);
> +    key = luaL_checkstring(L, 2);
> +    raw_key = apr_pstrcat(r->pool, "lua_ivm_", key, NULL);
> +    apr_pool_userdata_get((void **)&object, raw_key, r->server->process->pool);
> +    if (object) {
> +        if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);
> +        else if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);

Isn't that the same condition twice above?

> +        else if (object->type == LUA_TNUMBER) lua_pushnumber(L, object->number);
> +        else if (object->type == LUA_TSTRING) lua_pushlstring(L, object->string,
object->size);
> +        return 1;
> +    }
> +    else {
> +        return 0;
> +    }
> +}
> +
> +

Regards

RĂ¼diger


Mime
View raw message