ext/curb_postfield.c in curb-0.7.9 vs ext/curb_postfield.c in curb-0.7.10

- old
+ new

@@ -211,11 +211,11 @@ ruby_curl_postfield *rbcpf = ALLOC(ruby_curl_postfield); // wierdness - we actually require two args, unless a block is provided, but // we have to work that out below. rb_scan_args(argc, argv, "12&", &rbcpf->name, &rbcpf->content, &rbcpf->content_type, &rbcpf->content_proc); - + // special handling if theres a block, second arg is actually content_type if (rbcpf->content_proc != Qnil) { if (rbcpf->content != Qnil) { // we were given a content-type rbcpf->content_type = rbcpf->content; @@ -423,10 +423,11 @@ static VALUE ruby_curl_postfield_to_str(VALUE self) { // FIXME This is using the deprecated curl_escape func ruby_curl_postfield *rbcpf; VALUE result = Qnil; VALUE name = Qnil; + char *tmpchrs; Data_Get_Struct(self, ruby_curl_postfield, rbcpf); if (rbcpf->name != Qnil) { name = rbcpf->name; @@ -441,10 +442,10 @@ } if (name == Qnil) { rb_raise(eCurlErrInvalidPostField, "Cannot convert unnamed field to string %s:%d, make sure your field name responds_to :to_s", __FILE__, __LINE__); } - char *tmpchrs = curl_escape(StringValuePtr(name), (int)RSTRING_LEN(name)); + tmpchrs = curl_escape(StringValuePtr(name), (int)RSTRING_LEN(name)); if (!tmpchrs) { rb_raise(eCurlErrInvalidPostField, "Failed to url-encode name `%s'", tmpchrs); } else { VALUE tmpcontent = Qnil;