From 37130ceca33e5dd0ef2b4be28c2175dbd11471a8 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Mon, 28 Sep 2015 16:00:24 -0700 Subject: [PATCH] Minor optimization of ArrayPropertyNames --- src/RJSArray.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/RJSArray.cpp b/src/RJSArray.cpp index 6e70a6f4..bf6e975b 100644 --- a/src/RJSArray.cpp +++ b/src/RJSArray.cpp @@ -75,10 +75,11 @@ JSValueRef ArrayGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef pr void ArrayPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { ObjectArray *array = RJSGetInternal(object); + size_t size = array->size(); char str[32]; - for (int i = 0; i < array->link_view->size(); i++) { - sprintf(str, "%i", i); + for (size_t i = 0; i < size; i++) { + sprintf(str, "%zu", i); JSStringRef name = JSStringCreateWithUTF8CString(str); JSPropertyNameAccumulatorAddName(propertyNames, name); JSStringRelease(name);