mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-04 06:31:54 +00:00 
			
		
		
		
	[common] option: trim whitespace from option names and values
This commit is contained in:
		@@ -458,6 +458,9 @@ bool option_load(const char * filename)
 | 
			
		||||
            goto exit;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          //rtrim
 | 
			
		||||
          while(nameLen > 1 && (name[nameLen-1] == ' ' || name[nameLen-1] == '\t'))
 | 
			
		||||
            --nameLen;
 | 
			
		||||
          name[nameLen] = '\0';
 | 
			
		||||
          expectValue   = true;
 | 
			
		||||
 | 
			
		||||
@@ -480,6 +483,10 @@ bool option_load(const char * filename)
 | 
			
		||||
        }
 | 
			
		||||
        line = false;
 | 
			
		||||
 | 
			
		||||
        //ltrim
 | 
			
		||||
        if (*len == 0 && (c == ' ' || c == '\t'))
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        if (*len % 32 == 0)
 | 
			
		||||
          *p = realloc(*p, *len + 32 + 1);
 | 
			
		||||
        (*p)[(*len)++] = c;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user