diff --git a/lib/hcl-s.c b/lib/hcl-s.c index 8aebd8e..a5161b2 100644 --- a/lib/hcl-s.c +++ b/lib/hcl-s.c @@ -301,18 +301,6 @@ struct hcl_server_t /* ========================================================================= */ -#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) -# define HCL_IS_PATH_SEP(c) ((c) == '/' || (c) == '\\') -# define PATH_SEP_CHAR ('\\') -#else -# define HCL_IS_PATH_SEP(c) ((c) == '/') -# define PATH_SEP_CHAR ('/') -#endif - -/* TODO: handle path with a drive letter or in the UNC notation */ -#define HCL_IS_PATH_ABSOLUTE(x) HCL_IS_PATH_SEP(x[0]) - - static const hcl_bch_t* get_base_name (const hcl_bch_t* path) { const hcl_bch_t* p, * last = HCL_NULL; @@ -374,7 +362,7 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg) #else hcl_copy_bchars (bb->fn, server->cfg.script_include_path, parlen); #endif - if (!HCL_IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */ + if (!HCL_IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = HCL_DFL_PATH_SEP; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */ } else { diff --git a/lib/hcl-utl.h b/lib/hcl-utl.h index 7408e5f..22a0413 100644 --- a/lib/hcl-utl.h +++ b/lib/hcl-utl.h @@ -293,8 +293,10 @@ * ========================================================================= */ #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) # define HCL_IS_PATH_SEP(c) ((c) == '/' || (c) == '\\') +# define HCL_DFL_PATH_SEP ('\\') #else # define HCL_IS_PATH_SEP(c) ((c) == '/') +# define HCL_DFL_PATH_SEP ('/') #endif /* TODO: handle path with a drive letter or in the UNC notation */ diff --git a/lib/std.c b/lib/std.c index d130610..334c110 100644 --- a/lib/std.c +++ b/lib/std.c @@ -240,17 +240,18 @@ # endif #endif - -#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) -# define HCL_IS_PATH_SEP(c) ((c) == '/' || (c) == '\\') +#if defined(USE_THREAD) +# define MUTEX_INIT(x) pthread_mutex_init((x), MOO_NULL) +# define MUTEX_DESTROY(x) pthread_mutex_destroy(x) +# define MUTEX_LOCK(x) pthread_mutex_lock(x) +# define MUTEX_UNLOCK(x) pthread_mutex_unlock(x) #else -# define HCL_IS_PATH_SEP(c) ((c) == '/') +# define MUTEX_INIT(x) +# define MUTEX_DESTROY(x) +# define MUTEX_LOCK(x) +# define MUTEX_UNLOCK(x) #endif -/* TODO: handle path with a drive letter or in the UNC notation */ -#define HCL_IS_PATH_ABSOLUTE(x) HCL_IS_PATH_SEP(x[0]) - - typedef struct xtn_t xtn_t; struct xtn_t