From 22d5df8643299a8f742cf4d8f23ad36fedf8ce49 Mon Sep 17 00:00:00 2001 From: Geoff Gustafson Date: Wed, 29 Jun 2016 15:29:53 -0700 Subject: [PATCH] [cleanup] Removed unused function zjs_strequal, which has a bug anyway It could potentially write past the end of the stack buffer. Also, clean up a few typos. Signed-off-by: Geoff Gustafson --- src/zjs_util.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/zjs_util.c b/src/zjs_util.c index 7706854550ebda..918f797b3584a1 100644 --- a/src/zjs_util.c +++ b/src/zjs_util.c @@ -156,37 +156,12 @@ bool zjs_obj_get_uint32(jerry_object_t *obj, const char *name, return true; } -// FIXME: NOT BEING USED CURRENTLY -// zjs_obj_get_string + strcmp suffices for my current needs, although I had -// already debugged this function so I want to at least check it in and see if -// it becomes useful -bool zjs_strequal(const jerry_string_t *jstr, const char *str) -{ - // requires: str is null-terminated and should be small so we don't use up - // too much stack space - // effects: returns the results of strcmp between the string underlying - // jstr and str - int len = strlen(str); - jerry_size_t jlen = jerry_get_string_size(jstr); - if (len != jlen) - return false; - - char buffer[jlen]; - int wlen = jerry_string_to_char_buffer(jstr, buffer, jlen); - buffer[wlen] = '\0'; - for (int i=0; i