Changeset 895

Show
Ignore:
Timestamp:
12/11/07 18:14:17 (9 months ago)
Author:
filipe
Message:

Added compatibility for ruby1.9. Changes made:
* changed RSTRING(temp)->ptr to STRING_PTR(temp) (new macro available since ruby 1.8.6)
* changed RSTRING(data)->len to RSTRING_LEN(data) (new macro available since ruby 1.8.6)
* added ifndef conditions to check if macros STRING_PTR and STRING_LEN. If do not defined, create them.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ext/http11/http11.c

    r878 r895  
    99#include "http11_parser.h" 
    1010#include <ctype.h> 
     11 
     12#ifndef RSTRING_PTR 
     13#define RSTRING_PTR(s) (RSTRING(s)->ptr) 
     14#endif 
     15#ifndef RSTRING_LEN 
     16#define RSTRING_LEN(s) (RSTRING(s)->len) 
     17#endif 
    1118 
    1219static VALUE mMongrel; 
     
    7582  f = rb_str_buf_cat(f, field, flen);  
    7683 
    77   for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { 
     84  for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) { 
    7885    if(*ch == '-') { 
    7986      *ch = '_'; 
     
    170177  if((temp = rb_hash_aref(req, global_http_host)) != Qnil) { 
    171178    /* ruby better close strings off with a '\0' dammit */ 
    172     colon = strchr(RSTRING(temp)->ptr, ':'); 
     179    colon = strchr(RSTRING_PTR(temp), ':'); 
    173180    if(colon != NULL) { 
    174       rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING(temp)->ptr)); 
     181      rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp))); 
    175182      rb_hash_aset(req, global_server_port,  
    176           rb_str_substr(temp, colon - RSTRING(temp)->ptr+1,  
    177             RSTRING(temp)->len)); 
     183          rb_str_substr(temp, colon - RSTRING_PTR(temp)+1,  
     184            RSTRING_LEN(temp))); 
    178185    } else { 
    179186      rb_hash_aset(req, global_server_name, temp); 
     
    296303 
    297304  from = FIX2INT(start); 
    298   dptr = RSTRING(data)->ptr
    299   dlen = RSTRING(data)->len
     305  dptr = RSTRING_PTR(data)
     306  dlen = RSTRING_LEN(data)
    300307 
    301308  if(from >= dlen) {