Diff for /embedaddon/lighttpd/src/mod_magnet_cache.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2014/06/15 20:20:06 version 1.1.1.3, 2016/11/02 10:35:00
Line 1 Line 1
   #include "first.h"
   
 #include "mod_magnet_cache.h"  #include "mod_magnet_cache.h"
 #include "stat_cache.h"  #include "stat_cache.h"
   
Line 68  lua_State *script_cache_get_script(server *srv, connec Line 70  lua_State *script_cache_get_script(server *srv, connec
                         /* oops, the script failed last time */                          /* oops, the script failed last time */
   
                         if (lua_gettop(sc->L) == 0) break;                          if (lua_gettop(sc->L) == 0) break;
                           force_assert(lua_gettop(sc->L) == 1);
   
                         if (HANDLER_ERROR == stat_cache_get_entry(srv, con, sc->name, &sce)) {                          if (HANDLER_ERROR == stat_cache_get_entry(srv, con, sc->name, &sce)) {
                                 lua_pop(sc->L, 1); /* pop the old function */                                  lua_pop(sc->L, 1); /* pop the old function */
Line 81  lua_State *script_cache_get_script(server *srv, connec Line 84  lua_State *script_cache_get_script(server *srv, connec
                         }                          }
   
                         force_assert(lua_isfunction(sc->L, -1));                          force_assert(lua_isfunction(sc->L, -1));
                         lua_pushvalue(sc->L, -1); /* copy the function-reference */  
   
                         return sc->L;                          return sc->L;
                 }                  }
Line 104  lua_State *script_cache_get_script(server *srv, connec Line 106  lua_State *script_cache_get_script(server *srv, connec
   
                 cache->ptr[cache->used++] = sc;                  cache->ptr[cache->used++] = sc;
   
                buffer_copy_string_buffer(sc->name, name);                buffer_copy_buffer(sc->name, name);
   
                 sc->L = luaL_newstate();                  sc->L = luaL_newstate();
                 luaL_openlibs(sc->L);                  luaL_openlibs(sc->L);
Line 114  lua_State *script_cache_get_script(server *srv, connec Line 116  lua_State *script_cache_get_script(server *srv, connec
   
         if (0 != luaL_loadfile(sc->L, name->ptr)) {          if (0 != luaL_loadfile(sc->L, name->ptr)) {
                 /* oops, an error, return it */                  /* oops, an error, return it */
   
                 return sc->L;                  return sc->L;
         }          }
   
         if (HANDLER_GO_ON == stat_cache_get_entry(srv, con, sc->name, &sce)) {          if (HANDLER_GO_ON == stat_cache_get_entry(srv, con, sc->name, &sce)) {
                buffer_copy_string_buffer(sc->etag, sce->etag);                buffer_copy_buffer(sc->etag, sce->etag);
         }          }
   
         /**  
          * pcall() needs the function on the stack  
          *  
          * as pcall() will pop the script from the stack when done, we have to  
          * duplicate it here  
          */  
         force_assert(lua_isfunction(sc->L, -1));          force_assert(lua_isfunction(sc->L, -1));
         lua_pushvalue(sc->L, -1); /* copy the function-reference */  
   
         return sc->L;          return sc->L;
 }  }

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>