Changeset 158
- Timestamp:
- 12/26/2007 11:42:19 (11 months ago)
- Files:
-
- 1 modified
-
trunk/ext/hpricot_scan/hpricot_scan.rl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ext/hpricot_scan/hpricot_scan.rl
r117 r158 8 8 */ 9 9 #include <ruby.h> 10 11 #ifndef RARRAY_LEN 12 #define RARRAY_LEN(arr) RARRAY(arr)->len 13 #define RSTRING_LEN(str) RSTRING(str)->len 14 #define RSTRING_PTR(str) RSTRING(str)->ptr 15 #endif 10 16 11 17 #define NO_WAY_SERIOUSLY "*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!" … … 170 176 * prefix that must be preserved. Likely caused by super-long attributes. 171 177 * See ticket #13. */ 172 rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <%s>, starting on line %d.", RSTRING (tag)->ptr, curline);178 rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <%s>, starting on line %d.", RSTRING_PTR(tag), curline); 173 179 } 174 180 … … 183 189 184 190 StringValue(str); 185 memcpy( p, RSTRING (str)->ptr, RSTRING(str)->len);186 len = RSTRING (str)->len;191 memcpy( p, RSTRING_PTR(str), RSTRING_LEN(str) ); 192 len = RSTRING_LEN(str); 187 193 nread += len; 188 194 … … 200 206 if ( !NIL_P(tag) ) 201 207 { 202 rb_raise(rb_eHpricotParseError, "parse error on element <%s>, starting on line %d.\n" NO_WAY_SERIOUSLY, RSTRING (tag)->ptr, curline);208 rb_raise(rb_eHpricotParseError, "parse error on element <%s>, starting on line %d.\n" NO_WAY_SERIOUSLY, RSTRING_PTR(tag), curline); 203 209 } 204 210 else
