Changeset 481

Show
Ignore:
Timestamp:
03/30/07 09:10:06 (2 years ago)
Author:
hachi
Message:

Whitespace changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/client-xs-20070328/Cache-Memcached-GetParserXS/GetParserXS.xs

    r480 r481  
    9999  int state, copy, new_p; 
    100100  char *barekey; 
    101    
     101 
    102102  if (DEBUG) 
    103103    printf("get_buffer (nslen = %d)...\n", nslen); 
     
    109109 
    110110    if (DEBUG) { 
    111        char first_line[1000]; 
    112        int i; 
    113        char *end; 
    114        for (i = 0, end = buf; *end && *end != '\n' && i++ < 900; end++) 
    115          ; 
    116        end += 10; 
    117        strncpy (first_line, buf, end - buf + 1); 
    118        first_line[end - buf + 1] = '\0'; 
    119         printf("GOT buf (len=%d)\nFirst line: %s\n", len, first_line); 
     111      char first_line[1000]; 
     112      int i; 
     113      char *end; 
     114      for (i = 0, end = buf; *end && *end != '\n' && i++ < 900; end++) 
     115              ; 
     116      end += 10; 
     117      strncpy (first_line, buf, end - buf + 1); 
     118      first_line[end - buf + 1] = '\0'; 
     119      printf("GOT buf (len=%d)\nFirst line: %s\n", len, first_line); 
    120120    } 
    121121 
    122122    if ((c = *p++) == 'V') { 
    123123      if (*p++ != 'A' || *p++ != 'L' || *p++ != 'U' || *p++ != 'E' || *p++ != ' ') { 
    124        if (DEBUG) 
    125          puts ("ERROR: Illegal command beginning with V"); 
    126        goto recover_from_partial_line; 
    127       } 
    128          
     124        if (DEBUG) 
     125          puts ("ERROR: Illegal command beginning with V"); 
     126        goto recover_from_partial_line; 
     127      } 
     128 
    129129      // Parsing VALUE %s<key> %u<flags> %u<bytes> 
    130130 
    131131      for (key = p; *p++ > ' ';) 
    132        
     132       
    133133      key_len = p - key - 1; 
    134134      if (*(p - 1) != ' ') { 
    135        if (DEBUG) 
    136          printf ("ERROR: key not space-terminated: key %s, char %c\n", key, *(p - 1)); 
    137         goto recover_from_partial_line;          
     135        if (DEBUG) 
     136          printf ("ERROR: key not space-terminated: key %s, char %c\n", key, *(p - 1)); 
     137        goto recover_from_partial_line; 
    138138      } 
    139139      // Note that key just points into the buffer and is not null-terminated 
     
    144144 
    145145      for (flags = 0; (c = *p++ - '0') >= 0; flags = flags * 10 + c) 
    146        
     146       
    147147      if (c != (signed char)' ' - '0') { 
    148        if (DEBUG) 
    149          puts ("ERROR: Flags not space terminated"); 
    150         goto recover_from_partial_line;                  
    151       } 
    152  
    153        
     148        if (DEBUG) 
     149          puts ("ERROR: Flags not space terminated"); 
     150        goto recover_from_partial_line; 
     151      } 
     152 
     153 
    154154      for (itemlen = 0; (c = *p++ - '0') >= 0; itemlen = itemlen * 10 + c) 
    155        
     155       
    156156      if (c != (signed char)'\r' - '0' || *p++ != '\n') { 
    157        if (DEBUG) 
    158          puts ("ERROR: byte count not CRLF-terminated"); 
    159         goto recover_from_partial_line;                  
     157        if (DEBUG) 
     158          puts ("ERROR: byte count not CRLF-terminated"); 
     159        goto recover_from_partial_line; 
    160160      } 
    161161 
     
    170170 
    171171      if (DEBUG) { 
    172        char temp_key[256]; 
    173        strncpy (temp_key, key, key_len); 
    174        temp_key[key_len] = '\0'; 
     172        char temp_key[256]; 
     173        strncpy (temp_key, key, key_len); 
     174        temp_key[key_len] = '\0'; 
    175175        printf("key=[%s], state=%d, copy=%d\n", key, state, copy); 
    176176      } 
    177177 
    178178      if (copy) { 
    179        *(key + key_len) = '\0';        // Null-terminate the key in-buffer 
     179        *(key + key_len) = '\0';        // Null-terminate the key in-buffer 
    180180        hv_store(ret, barekey, barelen, newSVpv(buf + new_p, copy), 0); 
    181181        buf[new_p + copy - 1] = '\0'; 
     
    221221 
    222222    else if (c == 'E') { 
    223        
     223 
    224224      // Parsing END 
    225        
     225 
    226226      if (*p++ == 'N' && *p++ == 'D' && *p++ == '\r' && *p == '\n') 
    227        return final_answer(self, 1); 
     227        return final_answer(self, 1); 
    228228    } 
    229229    // Just fall through if after 'E' was not "ND\r\n" 
    230230 
    231     else  
    232       ;                        // Unknown command: not 'E' or 'V' at [0] 
     231    else 
     232      ;         // Unknown command: not 'E' or 'V' at [0] 
    233233 
    234234 
     
    304304} 
    305305 
    306 MODULE = Cache::Memcached::GetParserXS         PACKAGE = Cache::Memcached::GetParserXS          
     306MODULE = Cache::Memcached::GetParserXS      PACKAGE = Cache::Memcached::GetParserXS 
    307307 
    308308INCLUDE: const-xs.inc