Compare commits
4 Commits
07c8a6f056
...
1c41faaebc
Author | SHA1 | Date |
---|---|---|
Glenn Strauss | 1c41faaebc | |
Glenn Strauss | 78eb0e3945 | |
Glenn Strauss | 2a3cca7c56 | |
Glenn Strauss | 124543bbe1 |
5
src/ck.h
5
src/ck.h
|
@ -12,6 +12,11 @@
|
|||
#ifndef __STDC_WANT_LIB_EXT1__ /*(enable C11 Annex K ext1 *_s functions)*/
|
||||
#define __STDC_WANT_LIB_EXT1__ 1
|
||||
#endif
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
#include "first.h"
|
||||
#ifdef __FreeBSD__
|
||||
#ifndef _RSIZE_T_DEFINED /* expecting __EXT1_VISIBLE 1 and _RSIZE_T_DEFINED */
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_WANT_LIB_EXT1__
|
||||
#define __STDC_WANT_LIB_EXT1__ 1
|
||||
#endif
|
||||
|
|
|
@ -703,8 +703,8 @@ static const char js_simple_table_resort[] = \
|
|||
" var bt = get_inner_text(b.cells[sort_column]);\n" \
|
||||
" var cmp;\n" \
|
||||
" if (sort_column == name_column) {\n" \
|
||||
" if (at == '..') return -1;\n" \
|
||||
" if (bt == '..') return 1;\n" \
|
||||
" if (at == '../') return -1;\n" \
|
||||
" if (bt == '../') return 1;\n" \
|
||||
" }\n" \
|
||||
" if (a.cells[sort_column].className == 'int') {\n" \
|
||||
" cmp = parseInt(at)-parseInt(bt);\n" \
|
||||
|
|
|
@ -295,7 +295,11 @@ static int magnet_readdir(lua_State *L) {
|
|||
const char * const s = luaL_checkstring(L, 1);
|
||||
DIR * const d = opendir(s);
|
||||
if (d) {
|
||||
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 504
|
||||
DIR ** const dp = (DIR **)lua_newuserdata(L, sizeof(DIR *));
|
||||
#else
|
||||
DIR ** const dp = (DIR **)lua_newuserdatauv(L, sizeof(DIR *), 0);
|
||||
#endif
|
||||
*dp = d;
|
||||
magnet_readdir_metatable(L);
|
||||
lua_setmetatable(L, -2);
|
||||
|
@ -605,8 +609,12 @@ static int magnet_stat(lua_State *L) {
|
|||
* (script must not cache sce in persistent global state for later use)
|
||||
* (If we did want sce to be persistent, then could increment sce refcnt,
|
||||
* and set up __gc metatable method to decrement sce refcnt) */
|
||||
stat_cache_entry ** const udata = /* (sp += 1) */
|
||||
(struct stat_cache_entry **)lua_newuserdata(L, sizeof(stat_cache_entry *));
|
||||
stat_cache_entry ** const udata =(struct stat_cache_entry**)/* (sp += 1) */
|
||||
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 504
|
||||
lua_newuserdata(L, sizeof(stat_cache_entry *));
|
||||
#else
|
||||
lua_newuserdatauv(L, sizeof(stat_cache_entry *), 0);
|
||||
#endif
|
||||
*udata = sce;
|
||||
|
||||
magnet_stat_metatable(L); /* (sp += 1) */
|
||||
|
|
|
@ -137,7 +137,7 @@ sub wait_for_port_with_proc {
|
|||
|
||||
# the process is gone, we failed
|
||||
require POSIX;
|
||||
if (0 != waitpid($child, POSIX::WNOHANG)) {
|
||||
if (0 != waitpid($child, POSIX::WNOHANG())) {
|
||||
return -1;
|
||||
}
|
||||
if (0 >= $timeout) {
|
||||
|
|
Loading…
Reference in New Issue