src: squelch -Wmaybe-uninitialized warning
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 14 Mar 2014 20:59:48 +0000 (21:59 +0100)
committerFedor Indutny <fedor.indutny@gmail.com>
Sun, 16 Mar 2014 12:15:33 +0000 (16:15 +0400)
The variable isn't actually used uninitialized but g++ 4.8 doesn't know
that.  Set it to NULL to silence the following compiler warning:

    ../src/string_bytes.cc:247:29: warning: 'data' may be used
    uninitialized in this function [-Wmaybe-uninitialized]
         unsigned a = hex2bin(src[i * 2 + 0]);
                                  ^
    ../src/string_bytes.cc:299:15: note: 'data' was declared here
       const char* data;
                   ^

src/string_bytes.cc

index 3f9cdf4..d1ad4a1 100644 (file)
@@ -296,7 +296,7 @@ size_t StringBytes::Write(Isolate* isolate,
                           enum encoding encoding,
                           int* chars_written) {
   HandleScope scope(isolate);
-  const char* data;
+  const char* data = NULL;
   size_t len = 0;
   bool is_extern = GetExternalParts(isolate, val, &data, &len);