]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix some warnings about uninitialized variables
authorMikko Rasa <tdb@tdb.fi>
Sat, 3 Nov 2012 13:54:33 +0000 (15:54 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 3 Nov 2012 13:54:33 +0000 (15:54 +0200)
In reality they are always initialized when they're used, but the compiler
doesn't necessarily know that.

source/programbuilder.cpp

index c97ec1cb490b1943e38f58544a522a6a22349b99..30457838e89bae1270ff3648a79250624a82d69e 100644 (file)
@@ -375,7 +375,8 @@ vector<string> ProgramBuilder::extract_identifiers(const char *expression)
 {
        vector<string> result;
        const char *ptr = expression;
-       unsigned start, length;
+       unsigned start = 0;
+       unsigned length = 0;
        while(parse_identifier(ptr, start, length))
        {
                result.push_back(string(ptr+start, length));
@@ -388,7 +389,8 @@ string ProgramBuilder::replace_identifiers(const char *expression, const map<str
 {
        string result;
        const char *ptr = expression;
-       unsigned start, length;
+       unsigned start = 0;
+       unsigned length = 0;
        while(parse_identifier(ptr, start, length))
        {
                result.append(ptr, start);