From 2038be4c8fc6efaec78cc28d5786b9e604b3a0b5 Mon Sep 17 00:00:00 2001 From: "mccabe%netscape.com" Date: Thu, 11 Nov 1999 01:15:43 +0000 Subject: [PATCH] Warning fix for uninitialized structure members. r=fur,slamm. --- js/src/jsapi.h | 3 +++ js/src/jsmath.c | 61 +++++++++++++++++++++++++------------------------ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index cd6262a17d4..8a57e73b9f4 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -500,6 +500,9 @@ struct JSClass { #define JSCLASS_NEW_ENUMERATE 0x02 /* class has JSNewEnumerateOp method */ #define JSCLASS_NEW_RESOLVE 0x04 /* class has JSNewResolveOp method */ #define JSCLASS_PRIVATE_IS_NSISUPPORTS 0x08 /* private slot is nsISupports* */ +/* Fill in null values for unused members. */ +#define JSCLASS_NO_OPTIONAL_MEMBERS \ + 0,0,0,0,0,0,{0,0} struct JSObjectOps { /* Mandatory non-null function pointer members. */ diff --git a/js/src/jsmath.c b/js/src/jsmath.c index 3294a22c651..ddcf8e13019 100644 --- a/js/src/jsmath.c +++ b/js/src/jsmath.c @@ -76,22 +76,23 @@ #endif static JSConstDoubleSpec math_constants[] = { - {M_E, "E"}, - {M_LOG2E, "LOG2E"}, - {M_LOG10E, "LOG10E"}, - {M_LN2, "LN2"}, - {M_LN10, "LN10"}, - {M_PI, "PI"}, - {M_SQRT2, "SQRT2"}, - {M_SQRT1_2, "SQRT1_2"}, - {0} + {M_E, "E", 0, {0,0,0}}, + {M_LOG2E, "LOG2E", 0, {0,0,0}}, + {M_LOG10E, "LOG10E", 0, {0,0,0}}, + {M_LN2, "LN2", 0, {0,0,0}}, + {M_LN10, "LN10", 0, {0,0,0}}, + {M_PI, "PI", 0, {0,0,0}}, + {M_SQRT2, "SQRT2", 0, {0,0,0}}, + {M_SQRT1_2, "SQRT1_2", 0, {0,0,0}}, + {0,0,0,{0,0,0}} }; static JSClass math_class = { "Math", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub, + JSCLASS_NO_OPTIONAL_MEMBERS }; static JSBool @@ -412,27 +413,27 @@ math_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, static JSFunctionSpec math_static_methods[] = { #ifdef JS_HAS_TOSOURCE - {js_toSource_str, math_toSource, 0}, + {js_toSource_str, math_toSource, 0, 0, 0}, #endif - {"abs", math_abs, 1}, - {"acos", math_acos, 1}, - {"asin", math_asin, 1}, - {"atan", math_atan, 1}, - {"atan2", math_atan2, 2}, - {"ceil", math_ceil, 1}, - {"cos", math_cos, 1}, - {"exp", math_exp, 1}, - {"floor", math_floor, 1}, - {"log", math_log, 1}, - {"max", math_max, 2}, - {"min", math_min, 2}, - {"pow", math_pow, 2}, - {"random", math_random, 0}, - {"round", math_round, 1}, - {"sin", math_sin, 1}, - {"sqrt", math_sqrt, 1}, - {"tan", math_tan, 1}, - {0} + {"abs", math_abs, 1, 0, 0}, + {"acos", math_acos, 1, 0, 0}, + {"asin", math_asin, 1, 0, 0}, + {"atan", math_atan, 1, 0, 0}, + {"atan2", math_atan2, 2, 0, 0}, + {"ceil", math_ceil, 1, 0, 0}, + {"cos", math_cos, 1, 0, 0}, + {"exp", math_exp, 1, 0, 0}, + {"floor", math_floor, 1, 0, 0}, + {"log", math_log, 1, 0, 0}, + {"max", math_max, 2, 0, 0}, + {"min", math_min, 2, 0, 0}, + {"pow", math_pow, 2, 0, 0}, + {"random", math_random, 0, 0, 0}, + {"round", math_round, 1, 0, 0}, + {"sin", math_sin, 1, 0, 0}, + {"sqrt", math_sqrt, 1, 0, 0}, + {"tan", math_tan, 1, 0, 0}, + {0,0,0,0,0} }; JSObject *