Skip to content

Commit

Permalink
delete unused lines
Browse files Browse the repository at this point in the history
Signed-off-by: Su Yihan <[email protected]>
  • Loading branch information
yviansu committed Oct 11, 2023
1 parent e26d454 commit b7b7940
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
18 changes: 7 additions & 11 deletions runtime-library/libdyntype/dynamic/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "libdyntype_export.h"
#include "type.h"
#include <math.h>

extern JSValue *
dynamic_dup_value(JSContext *ctx, JSValue value);
Expand Down Expand Up @@ -1046,21 +1045,18 @@ int
dynamic_get_array_length(dyn_ctx_t ctx, dyn_value_t obj)
{
dyn_value_t length_value = NULL;
double length = 0;
int ret = -1;
int length = 0;

length_value = dynamic_get_property(ctx, obj, "length");
ret = dynamic_to_number(ctx, length_value, &length);
if (ret == DYNTYPE_SUCCESS) {
if (ceil(length) != floor(length)) {
ret = -DYNTYPE_TYPEERR;
} else {
ret = (int)floor(length);
}
if (!JS_IsNumber(*(JSValue *)length_value)) {
return -DYNTYPE_TYPEERR;
}
length = JS_VALUE_GET_TAG(*(JSValue *)length_value) == JS_TAG_INT
? JS_VALUE_GET_INT(*(JSValue *)length_value)
: -DYNTYPE_TYPEERR;
if (length_value) {
js_free(ctx->js_ctx, length_value);
}

return ret;
return length;
}
9 changes: 0 additions & 9 deletions runtime-library/libdyntype/libdyntype_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,6 @@ dyntype_release(dyn_ctx_t ctx, dyn_value_t obj);
void
dyntype_collect(dyn_ctx_t ctx);

/*****************************************************************
* *
* Section 2 *
* *
* Interface exposed to the runtime library *
* *
*****************************************************************/

/************************** Field access ***********************/
/**
* @brief Get array's length
*
Expand Down

0 comments on commit b7b7940

Please sign in to comment.