]> git.kaiwu.me - njs.git/commitdiff
Fixed gcc compilation with O3 optimization level.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 3 Jun 2025 02:08:27 +0000 (19:08 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 4 Jun 2025 23:55:44 +0000 (16:55 -0700)
src/qjs.c

index 7993de1ba94b8eaccd1ecebe2f670d1d760b3183..9c0fcdb47e6253f0ecee5764f0ce27ee6ff28e86 100644 (file)
--- a/src/qjs.c
+++ b/src/qjs.c
@@ -911,6 +911,11 @@ qjs_to_bytes(JSContext *ctx, qjs_bytes_t *bytes, JSValueConst value)
         goto string;
     }
 
+    /* GCC complains about uninitialized variables. */
+
+    byte_offset = 0;
+    byte_length = 0;
+
     val = JS_GetTypedArrayBuffer(ctx, value, &byte_offset, &byte_length, NULL);
     if (!JS_IsException(val)) {
         bytes->start = JS_GetArrayBuffer(ctx, &bytes->length, val);
@@ -967,6 +972,11 @@ qjs_typed_array_data(JSContext *ctx, JSValueConst value, njs_str_t *data)
     size_t   byte_offset, byte_length;
     JSValue  ab;
 
+    /* GCC complains about uninitialized variables. */
+
+    byte_offset = 0;
+    byte_length = 0;
+
     /* TODO: DataView. */
 
     ab = JS_GetTypedArrayBuffer(ctx, value, &byte_offset, &byte_length,