Changeset e2906f


Ignore:
Timestamp:
04/03/10 20:25:09 (2 years ago)
Author:
Tomash Brechko <tomash.brechko@…>
Branches:
master
Children:
81d6e9
Parents:
ddc0ed
git-author:
Tomash Brechko <tomash.brechko@…> (04/03/10 19:28:34)
git-committer:
Tomash Brechko <tomash.brechko@…> (04/03/10 20:25:09)
Message:

Fix RT#56142: handle Perl magic.

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • Changes

    rddc0ed re2906f  
    66 
    77        Changes since 0.17: 
     8 
     9        Fix RT#56142: handle Perl magic. 
    810 
    911        Fix SIGPIPE handling, make it thread-safe.  Now we use 
  • Fast.xs

    r50ab04 re2906f  
    11/* 
    2   Copyright (C) 2007-2009 Tomash Brechko.  All rights reserved. 
     2  Copyright (C) 2007-2010 Tomash Brechko.  All rights reserved. 
    33 
    44  This library is free software; you can redistribute it and/or modify 
     
    9999 
    100100            addr_sv = hv_fetch(hv, "address", 7, 0); 
    101             if (! addr_sv) 
     101            if (addr_sv) 
     102              SvGETMAGIC(*addr_sv); 
     103            else 
    102104              croak("server should have { address => $addr }"); 
    103105            ps = hv_fetch(hv, "weight", 6, 0); 
     106            if (ps) 
     107              SvGETMAGIC(*ps); 
    104108            if (ps && SvOK(*ps)) 
    105109              weight = SvNV(*ps); 
    106110            ps = hv_fetch(hv, "noreply", 7, 0); 
     111            if (ps) 
     112              SvGETMAGIC(*ps); 
    107113            if (ps && SvOK(*ps)) 
    108114              noreply = SvTRUE(*ps); 
     
    118124 
    119125            addr_sv = av_fetch(av, 0, 0); 
    120             if (! addr_sv) 
     126            if (addr_sv) 
     127              SvGETMAGIC(*addr_sv); 
     128            else 
    121129              croak("server should be [$addr, $weight]"); 
    122130            weight_sv = av_fetch(av, 1, 0); 
     
    146154 
    147155  ps = hv_fetch(conf, "utf8", 4, 0); 
     156  if (ps) 
     157    SvGETMAGIC(*ps); 
    148158  if (ps && SvOK(*ps)) 
    149159    memd->utf8 = SvTRUE(*ps); 
    150160 
    151161  ps = hv_fetch(conf, "serialize_methods", 17, 0); 
     162  if (ps) 
     163    SvGETMAGIC(*ps); 
    152164  if (ps && SvOK(*ps)) 
    153165    { 
     
    177189 
    178190  ps = hv_fetch(conf, "compress_threshold", 18, 0); 
     191  if (ps) 
     192    SvGETMAGIC(*ps); 
    179193  if (ps && SvOK(*ps)) 
    180194    memd->compress_threshold = SvIV(*ps); 
    181195 
    182196  ps = hv_fetch(conf, "compress_ratio", 14, 0); 
     197  if (ps) 
     198    SvGETMAGIC(*ps); 
    183199  if (ps && SvOK(*ps)) 
    184200    memd->compress_ratio = SvNV(*ps); 
    185201 
    186202  ps = hv_fetch(conf, "compress_methods", 16, 0); 
     203  if (ps) 
     204    SvGETMAGIC(*ps); 
    187205  if (ps && SvOK(*ps)) 
    188206    { 
     
    209227 
    210228  ps = hv_fetch(conf, "ketama_points", 13, 0); 
     229  if (ps) 
     230    SvGETMAGIC(*ps); 
    211231  if (ps && SvOK(*ps)) 
    212232    { 
     
    217237 
    218238  ps = hv_fetch(conf, "hash_namespace", 14, 0); 
     239  if (ps) 
     240    SvGETMAGIC(*ps); 
    219241  if (ps && SvOK(*ps)) 
    220242    client_set_hash_namespace(c, SvTRUE(*ps)); 
    221243 
    222244  ps = hv_fetch(conf, "servers", 7, 0); 
     245  if (ps) 
     246    SvGETMAGIC(*ps); 
    223247  if (ps && SvOK(*ps)) 
    224248    { 
     
    236260            continue; 
    237261 
     262          SvGETMAGIC(*ps); 
    238263          parse_server(memd, *ps); 
    239264        } 
     
    241266 
    242267  ps = hv_fetch(conf, "namespace", 9, 0); 
     268  if (ps) 
     269    SvGETMAGIC(*ps); 
    243270  if (ps && SvOK(*ps)) 
    244271    { 
     
    251278 
    252279  ps = hv_fetch(conf, "connect_timeout", 15, 0); 
     280  if (ps) 
     281    SvGETMAGIC(*ps); 
    253282  if (ps && SvOK(*ps)) 
    254283    client_set_connect_timeout(c, SvNV(*ps) * 1000.0); 
    255284 
    256285  ps = hv_fetch(conf, "io_timeout", 10, 0); 
     286  if (ps) 
     287    SvGETMAGIC(*ps); 
    257288  if (ps && SvOK(*ps)) 
    258289    client_set_io_timeout(c, SvNV(*ps) * 1000.0); 
     
    260291  /* For compatibility with Cache::Memcached.  */ 
    261292  ps = hv_fetch(conf, "select_timeout", 14, 0); 
     293  if (ps) 
     294    SvGETMAGIC(*ps); 
    262295  if (ps && SvOK(*ps)) 
    263296    client_set_io_timeout(c, SvNV(*ps) * 1000.0); 
    264297 
    265298  ps = hv_fetch(conf, "max_failures", 12, 0); 
     299  if (ps) 
     300    SvGETMAGIC(*ps); 
    266301  if (ps && SvOK(*ps)) 
    267302    client_set_max_failures(c, SvIV(*ps)); 
    268303 
    269304  ps = hv_fetch(conf, "failure_timeout", 15, 0); 
     305  if (ps) 
     306    SvGETMAGIC(*ps); 
    270307  if (ps && SvOK(*ps)) 
    271308    client_set_failure_timeout(c, SvIV(*ps)); 
    272309 
    273310  ps = hv_fetch(conf, "close_on_error", 14, 0); 
     311  if (ps) 
     312    SvGETMAGIC(*ps); 
    274313  if (ps && SvOK(*ps)) 
    275314    client_set_close_on_error(c, SvTRUE(*ps)); 
    276315 
    277316  ps = hv_fetch(conf, "nowait", 6, 0); 
     317  if (ps) 
     318    SvGETMAGIC(*ps); 
    278319  if (ps && SvOK(*ps)) 
    279320    client_set_nowait(c, SvTRUE(*ps)); 
    280321 
    281322  ps = hv_fetch(conf, "max_size", 8, 0); 
     323  if (ps) 
     324    SvGETMAGIC(*ps); 
    282325  if (ps && SvOK(*ps)) 
    283326    memd->max_size = SvUV(*ps); 
     
    690733            /* exptime doesn't have to be defined.  */ 
    691734            sv = ST(arg); 
     735            SvGETMAGIC(sv); 
    692736            if (SvOK(sv)) 
    693737              exptime = SvIV(sv); 
     
    778822                /* exptime doesn't have to be defined.  */ 
    779823                SV **ps = av_fetch(av, arg, 0); 
     824                if (ps) 
     825                  SvGETMAGIC(*ps); 
    780826                if (ps && SvOK(*ps)) 
    781827                  exptime = SvIV(*ps); 
     
    925971            /* increment doesn't have to be defined.  */ 
    926972            SV *sv = ST(2); 
     973            SvGETMAGIC(sv); 
    927974            if (SvOK(sv)) 
    928975              arg = SvUV(sv); 
     
    9841031                    /* increment doesn't have to be defined.  */ 
    9851032                    SV **ps = av_fetch(av, 1, 0); 
     1033                    if (ps) 
     1034                      SvGETMAGIC(*ps); 
    9861035                    if (ps && SvOK(*ps)) 
    9871036                      arg = SvUV(*ps); 
     
    10561105            /* delay doesn't have to be defined.  */ 
    10571106            SV *sv = ST(2); 
     1107            SvGETMAGIC(sv); 
    10581108            if (SvOK(sv) && SvUV(sv) != 0) 
    10591109              warn("non-zero delete expiration time is ignored"); 
     
    11151165                    /* delay doesn't have to be defined.  */ 
    11161166                    SV **ps = av_fetch(av, 1, 0); 
     1167                    if (ps) 
     1168                      SvGETMAGIC(*ps); 
    11171169                    if (ps && SvOK(*ps) && SvUV(*ps) != 0) 
    11181170                      warn("non-zero delete expiration time is ignored"); 
     
    11791231        sv_2mortal((SV *) RETVAL); 
    11801232        object.arg = sv_2mortal((SV *) newAV()); 
    1181         if (items > 1 && SvOK(ST(1))) 
    1182           delay = SvUV(ST(1)); 
     1233        if (items > 1) 
     1234          { 
     1235            SV *sv = ST(1); 
     1236            SvGETMAGIC(sv); 
     1237            if (SvOK(sv)) 
     1238              delay = SvUV(sv); 
     1239          } 
    11831240        noreply = (GIMME_V == G_VOID); 
    11841241        client_flush_all(memd->c, delay, &object, noreply); 
  • MANIFEST

    r50ab04 re2906f  
    1616t/commands.t 
    1717t/key_ref.t 
     18t/magic.t 
    1819t/namespace.t 
    1920t/nowait.t 
Note: See TracChangeset for help on using the changeset viewer.