Skip to content

Commit 21ce6bc

Browse files
authored
Merge pull request zephyrproject-rtos#17 from grgustaf/remove-unused-func
[cleanup] Removed unused function zjs_strequal, which has a bug anyway
2 parents 0685c4e + 22d5df8 commit 21ce6bc

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/zjs_util.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -156,37 +156,12 @@ bool zjs_obj_get_uint32(jerry_object_t *obj, const char *name,
156156
return true;
157157
}
158158

159-
// FIXME: NOT BEING USED CURRENTLY
160-
// zjs_obj_get_string + strcmp suffices for my current needs, although I had
161-
// already debugged this function so I want to at least check it in and see if
162-
// it becomes useful
163-
bool zjs_strequal(const jerry_string_t *jstr, const char *str)
164-
{
165-
// requires: str is null-terminated and should be small so we don't use up
166-
// too much stack space
167-
// effects: returns the results of strcmp between the string underlying
168-
// jstr and str
169-
int len = strlen(str);
170-
jerry_size_t jlen = jerry_get_string_size(jstr);
171-
if (len != jlen)
172-
return false;
173-
174-
char buffer[jlen];
175-
int wlen = jerry_string_to_char_buffer(jstr, buffer, jlen);
176-
buffer[wlen] = '\0';
177-
for (int i=0; i<len; i++) {
178-
if (buffer[i] != str[i])
179-
return false;
180-
}
181-
return true;
182-
}
183-
184159
/**
185160
* Initialize Jerry value with specified object
186161
*/
187162
void zjs_init_value_object(jerry_value_t *out_value_p, jerry_object_t *v)
188163
{
189-
// requires: out_value_p to recieve the object value v
164+
// requires: out_value_p to receive the object value v
190165
// effects: put the object into out_value_p with appropriate encoding.
191166
jerry_acquire_object(v);
192167
*out_value_p = jerry_create_object_value(v);
@@ -197,7 +172,7 @@ void zjs_init_value_object(jerry_value_t *out_value_p, jerry_object_t *v)
197172
*/
198173
void zjs_init_value_string(jerry_value_t *out_value_p, const char *v)
199174
{
200-
// requires: out_value_p to recieve the string value v
175+
// requires: out_value_p to receive the string value v
201176
// effects: put the string into out_value_p with appropriate encoding.
202177
*out_value_p = jerry_create_string_value(jerry_create_string((jerry_char_t *) v));
203178
}

0 commit comments

Comments
 (0)