[Freeswitch-svn] [commit] r7391 - freeswitch/trunk/src/mod/languages/mod_spidermonkey

Freeswitch SVN silik0n at freeswitch.org
Sun Jan 27 01:07:36 EST 2008


Author: silik0n
Date: Sun Jan 27 01:07:35 2008
New Revision: 7391

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

Log:
save a few bytes cause I am too cheap to buy more ram (white space clean up)

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Sun Jan 27 01:07:35 2008
@@ -276,7 +276,6 @@
 	{0}
 };
 
-
 static JSBool request_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 {
 	JSBool res = JS_TRUE;
@@ -307,14 +306,12 @@
 	return res;
 }
 
-
 JSClass request_class = {
 	"Request", JSCLASS_HAS_PRIVATE,
 	JS_PropertyStub, JS_PropertyStub, request_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, request_destroy, NULL, NULL, NULL, NULL
 };
 
-
 static JSObject *new_request(JSContext *cx, JSObject *obj, struct request_obj *ro)
 {
 	JSObject *Request;
@@ -424,13 +421,11 @@
 	{0}
 };
 
-
 static JSPropertySpec pcre_props[] = {
 	{"ready", PCRE_READY, JSPROP_READONLY | JSPROP_PERMANENT},
 	{0}
 };
 
-
 static JSBool pcre_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
@@ -696,8 +691,6 @@
 	return JS_TRUE;
 }
 
-
-
 enum event_tinyid {
 	EVENT_READY
 };
@@ -714,13 +707,11 @@
 	{0}
 };
 
-
 static JSPropertySpec event_props[] = {
 	{"ready", EVENT_READY, JSPROP_READONLY | JSPROP_PERMANENT},
 	{0}
 };
 
-
 static JSBool event_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
@@ -733,7 +724,6 @@
 		return JS_TRUE;
 	}
 
-
 	name = JS_GetStringBytes(JS_ValueToString(cx, id));
 	/* numbers are our props anything else is a method */
 	if (name[0] >= 48 && name[0] <= 57) {
@@ -758,12 +748,10 @@
 	event_construct
 };
 
-
 /* Dtmf Object */
 /*********************************************************************************/
 static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
-
 	switch_dtmf_t *dtmf;
 	int32 duration = SWITCH_DEFAULT_DTMF_DURATION;
 	char *ename;
@@ -786,7 +774,6 @@
 		JS_SetPrivate(cx, obj, dtmf);
 		return JS_TRUE;
 	}
-	
 
 	return JS_FALSE;
 }
@@ -816,7 +803,6 @@
 	{0}
 };
 
-
 static JSBool dtmf_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
@@ -829,7 +815,6 @@
 		return JS_TRUE;
 	}
 
-
 	name = JS_GetStringBytes(JS_ValueToString(cx, id));
 	/* numbers are our props anything else is a method */
 	if (name[0] >= 48 && name[0] <= 57) {
@@ -863,7 +848,6 @@
 	dtmf_construct
 };
 
-
 static void js_error(JSContext * cx, const char *message, JSErrorReport * report)
 {
 	const char *filename = __FILE__;
@@ -887,10 +871,8 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, filename, modname, line, NULL, SWITCH_LOG_ERROR, "%s %s%s\n", ex, message, text);
-
 }
 
-
 static switch_status_t sm_load_file(char *filename)
 {
 	sm_loadable_module_t *module = NULL;
@@ -956,7 +938,6 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module->filename);
 
 	return SWITCH_STATUS_SUCCESS;
-
 }
 
 static switch_status_t sm_load_module(const char *dir, const char *fname)
@@ -971,7 +952,6 @@
 	const char *ext = ".so";
 #endif
 
-
 	if ((file = switch_core_strdup(module_manager.pool, fname)) == 0) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1081,7 +1061,6 @@
 	return Event;
 }
 
-
 JSObject *new_js_dtmf(switch_dtmf_t *dtmf, char *name, JSContext * cx, JSObject * obj)
 {
 	JSObject *DTMF = NULL;
@@ -1113,7 +1092,6 @@
 	jsval nval , *rval = &nval; 
 	JSContext *cx = cb_state->cx;
 	JSObject *obj = cb_state->obj;
-	
 
 	METHOD_SANITY_CHECK();
 
@@ -1158,8 +1136,6 @@
 		argv[argc++] = cb_state->arg;
 	}
 
-
-
 	if (jss->stack_depth > MAX_STACK_DEPTH) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Maximum recursive callback limit %d reached.\n", MAX_STACK_DEPTH);
 		jss->stack_depth--;
@@ -1368,7 +1344,6 @@
 	channel = switch_core_session_get_channel(jss->session);
 	switch_assert(channel != NULL);
 
-
 	while (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
 		switch_event_destroy(&event);
 	}
@@ -1399,7 +1374,6 @@
 
 	CHANNEL_SANITY_CHECK();
 
-
 	if (argc > 0) {
 		file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		if (switch_strlen_zero(file_name)) {
@@ -1439,7 +1413,6 @@
 		}
 	}
 
-
 	cb_state.extra = &fh;
 	cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
 	cb_state.saveDepth = JS_SuspendRequest(cx);
@@ -1453,7 +1426,6 @@
 	return JS_TRUE;
 }
 
-
 static JSBool session_collect_input(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -1466,7 +1438,6 @@
 	JSFunction *function;
 	switch_input_args_t args = { 0 };
 
-
 	METHOD_SANITY_CHECK();
 
 	channel = switch_core_session_get_channel(jss->session);
@@ -1542,7 +1513,6 @@
 		return JS_FALSE;
 	}
 
-
 	if (argc > 1) {
 		phrase_data = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 	}
@@ -1621,7 +1591,6 @@
 		}
 	}
 
-
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1671,7 +1640,6 @@
 
 	CHANNEL_SANITY_CHECK();
 
-
 	if (argc > 0) {
 		file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		if (switch_strlen_zero(file_name)) {
@@ -1710,7 +1678,6 @@
         }
     }
 
-
 	cb_state.extra = &fh;
 	cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
 	cb_state.saveDepth = JS_SuspendRequest(cx);
@@ -1792,7 +1759,6 @@
 	}
 }
 
-
 static switch_status_t init_speech_engine(struct js_session *jss, char *engine, char *voice)
 {
 	switch_codec_t *read_codec;
@@ -1817,7 +1783,6 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-
 	if (switch_core_speech_open(&jss->speech->sh, engine, voice, rate, interval,
 								&flags, switch_core_session_get_pool(jss->session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
@@ -1829,7 +1794,6 @@
 
 }
 
-
 static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -1861,7 +1825,6 @@
 	voice_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 	text = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
 
-
 	if (switch_strlen_zero(tts_name)) {
 		eval_some_js("~throw new Error(\"Invalid TTS Name\");", cx, obj, rval);
 		return JS_FALSE;
@@ -1872,7 +1835,6 @@
 		return JS_FALSE;
 	}
 
-
 	if (jss->speech && strcasecmp(jss->speech->sh.name, tts_name)) {
 		destroy_speech_engine(jss);
 	}
@@ -1906,7 +1868,6 @@
 		}
 	}
 
-
 	codec = switch_core_session_get_read_codec(jss->session);
 	cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
 	cb_state.saveDepth = JS_SuspendRequest(cx);
@@ -1962,7 +1923,6 @@
 			JS_ValueToInt32(cx, argv[4], &abs_timeout);
 		}
 
-
 		switch_ivr_collect_digits_count(jss->session, buf, sizeof(buf), digits, terminators, &term, timeout, digit_timeout, abs_timeout);
 		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
 		return JS_TRUE;
@@ -2061,8 +2021,6 @@
 	return JS_TRUE;
 }
 
-
-
 static JSBool session_wait_for_media(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2104,7 +2062,6 @@
 	return JS_TRUE;
 }
 
-
 static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2158,7 +2115,6 @@
 
 	/* you can execute some apps before you answer */
 	/* CHANNEL_SANITY_CHECK(); */
-	
 
 	if (argc > 0) {
 		const switch_application_interface_t *application_interface;
@@ -2212,7 +2168,6 @@
 
 	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 	return JS_TRUE;
-
 }
 
 static JSBool session_send_event(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -2238,10 +2193,8 @@
 
 	*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
 	return JS_TRUE;
-
 }
 
-
 static JSBool session_hangup(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2261,7 +2214,6 @@
 		cause = switch_channel_str2cause(cause_name);
 	}
 
-
 	switch_channel_hangup(channel, cause);
 	switch_core_session_kill_channel(jss->session, SWITCH_SIG_KILL);
 	return JS_TRUE;
@@ -2327,11 +2279,8 @@
 		}
 	}
 	return realsize;
-
 }
 
-
-
 static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
 {
 	register unsigned int realsize = (unsigned int) (size * nmemb);
@@ -2462,7 +2411,6 @@
 	return JS_TRUE;
 }
 
-
 static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	char *url = NULL;
@@ -2531,7 +2479,6 @@
 }
 #endif
 
-
 /* Session Object */
 /*********************************************************************************/
 enum session_tinyid {
@@ -2568,7 +2515,6 @@
 	{0}
 };
 
-
 static JSPropertySpec session_props[] = {
 	{"name", SESSION_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
 	{"state", SESSION_STATE, JSPROP_READONLY | JSPROP_PERMANENT},
@@ -2586,7 +2532,6 @@
 	{0}
 };
 
-
 static JSBool session_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2674,7 +2619,6 @@
 	default:
 		*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
 		break;
-
 	}
 
 	return JS_TRUE;
@@ -2687,7 +2631,6 @@
 	session_construct
 };
 
-
 static JSObject *new_js_session(JSContext * cx, JSObject * obj, switch_core_session_t *session, struct js_session **jss, char *name, int flags)
 {
 	JSObject *session_obj;
@@ -2775,10 +2718,8 @@
 	}
 	
 	return JS_TRUE;
-
 }
 
-
 static JSBool session_originate(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = NULL;
@@ -3071,14 +3012,12 @@
 	{0}
 };
 
-
 static JSPropertySpec fileio_props[] = {
 	{"path", FILEIO_PATH, JSPROP_READONLY | JSPROP_PERMANENT},
 	{"open", FILEIO_OPEN, JSPROP_READONLY | JSPROP_PERMANENT},
 	{0}
 };
 
-
 static JSBool fileio_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
@@ -3117,7 +3056,6 @@
 	fileio_construct
 };
 
-
 /* Built-In*/
 /*********************************************************************************/
 static JSBool js_exit(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -3149,7 +3087,6 @@
 		line = JS_GetScriptBaseLineNumber(cx, script);
 	}
 
-
 	if (argc > 1) {
 		if ((level_str = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
 			level = switch_log_str2level(level_str);
@@ -3220,7 +3157,6 @@
 	}
 
 	return JS_TRUE;
-
 }
 
 static JSBool js_api_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -3252,7 +3188,6 @@
 			}
 		}
 
-
 		stream.data = retbuf;
 		stream.end = stream.data;
 		stream.data_size = sizeof(retbuf);
@@ -3304,7 +3239,6 @@
 		return JS_FALSE;
 	}
 
-
 	if (argc > 2) {
 		if ((function = JS_ValueToFunction(cx, argv[2]))) {
 			memset(&cb_state, 0, sizeof(cb_state));
@@ -3351,7 +3285,6 @@
 	return JS_FALSE;
 }
 
-
 static JSBool js_file_unlink(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	const char *path;
@@ -3388,10 +3321,8 @@
 	{0}
 };
 
-
 static int env_init(JSContext * cx, JSObject * javascript_object)
 {
-
 	JS_DefineFunctions(cx, javascript_object, fs_functions);
 
 	JS_InitStandardClasses(cx, javascript_object);
@@ -3469,7 +3400,6 @@
 	}
 
 	return;
-
 }
 
 SWITCH_STANDARD_APP(js_dp_function)
@@ -3490,7 +3420,6 @@
 	return NULL;
 }
 
-
 static switch_memory_pool_t *module_pool = NULL;
 
 static void js_thread_launch(const char *text)
@@ -3540,7 +3469,6 @@
 
 SWITCH_STANDARD_API(launch_async)
 {
-
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "USAGE: %s\n", js_run_interface.syntax);
 		return SWITCH_STATUS_SUCCESS;
@@ -3570,7 +3498,6 @@
 
 		switch_safe_free(path);
 	}
-
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load)



More information about the Freeswitch-svn mailing list