Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
ERROR MESSAGE GENERATED BY GCC: mysql.c: In function ‘escape_string’: mysql.c:295: error: lvalue required as left operand of assignment mysql.c:295: error: lvalue required as left operand of assignment mysql.c: In function ‘real_escape_string’: mysql.c:433: error: lvalue required as left operand of assignment mysql.c:433: error: lvalue required as left operand of assignment make: *** [mysql.o] Error 1 ======================================== ERROR MESSAGE GENERATED BY CLANG: rb_str_set_len(ret, mysql_escape_string(RSTRING_PTR(ret), RSTRING_PTR(str), RSTRING_LEN(str))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mysql.c:16:55: note: instantiated from: #define rb_str_set_len(str, length) (RSTRING_LEN(str) = (length)) ^ mysql.c:434:5: error: expression is not assignable rb_str_set_len(ret, mysql_real_escape_string(m, RSTRING_PTR(ret), RSTRING_PTR(str), RSTRING_LEN(str))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mysql.c:16:55: note: instantiated from: #define rb_str_set_len(str, length) (RSTRING_LEN(str) = (length)) ======================================== LINE GENERATING THE ERROR: rb_str_set_len(ret, mysql_escape_string(RSTRING_PTR(ret), RSTRING_PTR(str), RSTRING_LEN(str))); ======================================== POSSIBLY RELEVANT CODE FROM MYSQL.C: #ifndef RSTRING_PTR #define RSTRING_PTR(str) RSTRING(str)->ptr #endif #ifndef RSTRING_LEN #define RSTRING_LEN(str) RSTRING(str)->len #endif #ifndef RARRAY_PTR #define RARRAY_PTR(ary) RARRAY(ary)->ptr #endif #ifndef HAVE_RB_STR_SET_LEN #define rb_str_set_len(str, length) (RSTRING_LEN(str) = (length)) #endif
This paste will be private.
From the Design Piracy series on my blog: