]> git.sesse.net Git - vlc/commitdiff
Use pushliteral instead of pushstring where possible. Saves a strlen call.
authorAntoine Cellerier <dionoea@videolan.org>
Fri, 26 Feb 2010 11:14:26 +0000 (12:14 +0100)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 27 Feb 2010 21:04:23 +0000 (22:04 +0100)
modules/misc/lua/libs/misc.c
modules/misc/lua/libs/net.c
modules/misc/lua/libs/objects.c
modules/misc/lua/libs/playlist.c
modules/misc/lua/libs/sd.c
modules/misc/lua/libs/variables.c

index 444092dada9b143bc7a995d92108c2653ef8fe93..4460e12e6b01b77e76763cf390c528f9dceb1ec7 100644 (file)
@@ -90,7 +90,7 @@ static int vlclua_version( lua_State *L )
  *****************************************************************************/
 static int vlclua_copyright( lua_State *L )
 {
-    lua_pushstring( L, COPYRIGHT_MESSAGE );
+    lua_pushliteral( L, COPYRIGHT_MESSAGE );
     return 1;
 }
 
index 090470495d49b381bac2536d478aaaed705a06b4..90eec66871be3b77bd3fa79fbc4127ee0fe6f638 100644 (file)
@@ -263,31 +263,31 @@ static int vlclua_stat( lua_State *L )
         //return luaL_error( L, "Couldn't stat %s.", psz_path );
     lua_newtable( L );
     if( S_ISREG( s.st_mode ) )
-        lua_pushstring( L, "file" );
+        lua_pushliteral( L, "file" );
     else if( S_ISDIR( s.st_mode ) )
-        lua_pushstring( L, "dir" );
+        lua_pushliteral( L, "dir" );
 #ifdef S_ISCHR
     else if( S_ISCHR( s.st_mode ) )
-        lua_pushstring( L, "character device" );
+        lua_pushliteral( L, "character device" );
 #endif
 #ifdef S_ISBLK
     else if( S_ISBLK( s.st_mode ) )
-        lua_pushstring( L, "block device" );
+        lua_pushliteral( L, "block device" );
 #endif
 #ifdef S_ISFIFO
     else if( S_ISFIFO( s.st_mode ) )
-        lua_pushstring( L, "fifo" );
+        lua_pushliteral( L, "fifo" );
 #endif
 #ifdef S_ISLNK
     else if( S_ISLNK( s.st_mode ) )
-        lua_pushstring( L, "symbolic link" );
+        lua_pushliteral( L, "symbolic link" );
 #endif
 #ifdef S_ISSOCK
     else if( S_ISSOCK( s.st_mode ) )
-        lua_pushstring( L, "socket" );
+        lua_pushliteral( L, "socket" );
 #endif
     else
-        lua_pushstring( L, "unknown" );
+        lua_pushliteral( L, "unknown" );
     lua_setfield( L, -2, "type" );
     lua_pushinteger( L, s.st_mode );
     lua_setfield( L, -2, "mode" );
index 36c5409430d8bf9ac1c12f3e674f3b6dd9a470dc..a10a5f3d4a4e94c23563f3ce0376c1bb0538d1af 100644 (file)
@@ -61,7 +61,7 @@ int __vlclua_push_vlc_object( lua_State *L, vlc_object_t *p_obj,
     if( luaL_newmetatable( L, "vlc_object" ) )
     {
         /* Hide the metatable */
-        lua_pushstring( L, "none of your business" );
+        lua_pushliteral( L, "none of your business" );
         lua_setfield( L, -2, "__metatable" );
         if( pf_gc ) /* FIXME */
         {
index f7d9d107f47cbefbd3e8497d0d51c95ff467c52e..55de0234a26ce848100a32d31f3d93dcb59307a6 100644 (file)
@@ -338,16 +338,16 @@ static int vlclua_playlist_status( lua_State *L )
     switch( playlist_Status( p_playlist ) )
     {
         case PLAYLIST_STOPPED:
-            lua_pushstring( L, "stopped" );
+            lua_pushliteral( L, "stopped" );
             break;
         case PLAYLIST_RUNNING:
-            lua_pushstring( L, "playing" );
+            lua_pushliteral( L, "playing" );
             break;
         case PLAYLIST_PAUSED:
-            lua_pushstring( L, "paused" );
+            lua_pushliteral( L, "paused" );
             break;
         default:
-            lua_pushstring( L, "unknown" );
+            lua_pushliteral( L, "unknown" );
             break;
     }
     PL_UNLOCK;
index a5bb09fab2c7b3b6a09fe7337bcc732b870a4754..85e1f59f29f7f5f859e67f22a22ee96993642437 100644 (file)
@@ -185,7 +185,7 @@ static int vlclua_sd_add_item( lua_State *L )
             *udata = p_input;
             if( luaL_newmetatable( L, "input_item_t" ) )
             {
-                lua_pushstring( L, "none of your business" );
+                lua_pushliteral( L, "none of your business" );
                 lua_setfield( L, -2, "__metatable" );
             }
             lua_setmetatable( L, -2 );
@@ -250,7 +250,7 @@ static int vlclua_node_add_subitem( lua_State *L )
                 *udata = p_input;
                 if( luaL_newmetatable( L, "input_item_t" ) )
                 {
-                    lua_pushstring( L, "none of your business" );
+                    lua_pushliteral( L, "none of your business" );
                     lua_setfield( L, -2, "__metatable" );
                 }
                 lua_setmetatable( L, -2 );
index c7820220c273864da74a28a5f8810245f0530ebc..9c86a28da71ee6968d9dcaba9aaa45bfc53db175 100644 (file)
@@ -224,7 +224,7 @@ static int vlclua_command( lua_State *L )
     }
     else
     {
-        lua_pushstring( L, "" );
+        lua_pushliteral( L, "" );
     }
     return vlclua_push_ret( L, ret ) + 1;
 }