From 5d1e952a94a1e70084847756b489d8a48534ffbc Mon Sep 17 00:00:00 2001 From: Martin Nilsson <nilsson@opera.com> Date: Sat, 5 Nov 2011 16:46:15 +0100 Subject: [PATCH] Fix a warning about returning uninitialized pointer by not returning the pointer at all. --- src/constants.c | 34 +++++++++++++++------------------- src/constants.h | 26 +++++++++++++------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/constants.c b/src/constants.c index 67d2ef25ae..e76a02d972 100644 --- a/src/constants.c +++ b/src/constants.c @@ -134,16 +134,15 @@ PMOD_EXPORT struct callable *make_callable(c_fun fun, flags, optimize, docode); } -PMOD_EXPORT struct callable *add_efun2(const char *name, - c_fun fun, - const char *type, - int flags, - optimize_fun optimize, - docode_fun docode) +PMOD_EXPORT void add_efun2(const char *name, + c_fun fun, + const char *type, + int flags, + optimize_fun optimize, + docode_fun docode) { struct svalue s; struct pike_string *n; - struct callable *ret; n=make_shared_string(name); SET_SVAL(s, T_FUNCTION, FUNCTION_BUILTIN, efun, @@ -151,25 +150,23 @@ PMOD_EXPORT struct callable *add_efun2(const char *name, low_add_efun(n, &s); free_svalue(&s); free_string(n); - return ret; } -PMOD_EXPORT struct callable *add_efun(const char *name, c_fun fun, const char *type, int flags) +PMOD_EXPORT void add_efun(const char *name, c_fun fun, const char *type, int flags) { - return add_efun2(name,fun,type,flags,0,0); + add_efun2(name,fun,type,flags,0,0); } -PMOD_EXPORT struct callable *quick_add_efun(const char *name, ptrdiff_t name_length, - c_fun fun, - const char *type, ptrdiff_t type_length, - int flags, - optimize_fun optimize, - docode_fun docode) +PMOD_EXPORT void quick_add_efun(const char *name, ptrdiff_t name_length, + c_fun fun, + const char *type, ptrdiff_t type_length, + int flags, + optimize_fun optimize, + docode_fun docode) { struct svalue s; struct pike_string *n; struct pike_type *t; - struct callable *ret; #ifdef PIKE_DEBUG if(simple_mapping_string_lookup(builtin_constants, name)) @@ -183,11 +180,10 @@ PMOD_EXPORT struct callable *quick_add_efun(const char *name, ptrdiff_t name_len #endif add_ref(n); SET_SVAL(s, T_FUNCTION, FUNCTION_BUILTIN, efun, - ret = low_make_callable(fun, n, t, flags, optimize, docode)); + low_make_callable(fun, n, t, flags, optimize, docode)); mapping_string_insert(builtin_constants, n, &s); free_svalue(&s); free_string(n); - return ret; } PMOD_EXPORT void visit_callable (struct callable *c, int action) diff --git a/src/constants.h b/src/constants.h index 7e0b2de407..6c894b1a69 100644 --- a/src/constants.h +++ b/src/constants.h @@ -61,19 +61,19 @@ PMOD_EXPORT struct callable *make_callable(c_fun fun, int flags, optimize_fun optimize, docode_fun docode); -PMOD_EXPORT struct callable *add_efun2(const char *name, - c_fun fun, - const char *type, - int flags, - optimize_fun optimize, - docode_fun docode); -PMOD_EXPORT struct callable *add_efun(const char *name, c_fun fun, const char *type, int flags); -PMOD_EXPORT struct callable *quick_add_efun(const char *name, ptrdiff_t name_length, - c_fun fun, - const char *type, ptrdiff_t type_length, - int flags, - optimize_fun optimize, - docode_fun docode); +PMOD_EXPORT void add_efun2(const char *name, + c_fun fun, + const char *type, + int flags, + optimize_fun optimize, + docode_fun docode); +PMOD_EXPORT void add_efun(const char *name, c_fun fun, const char *type, int flags); +PMOD_EXPORT void quick_add_efun(const char *name, ptrdiff_t name_length, + c_fun fun, + const char *type, ptrdiff_t type_length, + int flags, + optimize_fun optimize, + docode_fun docode); PMOD_EXPORT void visit_callable (struct callable *c, int action); void init_builtin_constants(void); void exit_builtin_constants(void); -- GitLab