Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 471cea1f authored by deuce's avatar deuce

Add *_TO_MSTRING() macros to return malloc()ed strings instead of the current

alloca()ed ones.
parent f3b8a39b
......@@ -111,6 +111,33 @@ extern int thread_suid_broken; /* NPTL is no longer broken */
#include <jsapi.h>
#define JS_DestroyScript(cx,script)
#define JSSTRING_TO_MSTRING(cx, str, ret, lenptr) \
{ \
size_t *JSSTSlenptr=lenptr; \
size_t JSSTSlen; \
size_t JSSTSpos; \
const jschar *JSSTSstrval; \
\
if(JSSTSlenptr==NULL) \
JSSTSlenptr=&JSSTSlen; \
(ret)=NULL; \
if((str) != NULL) { \
if((JSSTSstrval=JS_GetStringCharsAndLength((cx), (str), JSSTSlenptr))) { \
if(((ret)=(char *)malloc(*JSSTSlenptr+1))) { \
for(JSSTSpos=0; JSSTSpos<*JSSTSlenptr; JSSTSpos++) \
(ret)[JSSTSpos]=(char)JSSTSstrval[JSSTSpos]; \
(ret)[*JSSTSlenptr]=0; \
} \
} \
} \
}
#define JSVALUE_TO_MSTRING(cx, val, ret, lenptr) \
{ \
JSString *JSVTSstr=JS_ValueToString((cx), (val)); \
JSSTRING_TO_MSTRING((cx), JSVTSstr, (ret), lenptr); \
}
#define JSSTRING_TO_STRING(cx, str, ret, lenptr) \
{ \
size_t *JSSTSlenptr=lenptr; \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment