clogger 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v1.2.0
4
+ DEF_VER=v1.3.0
5
5
 
6
6
  LF='
7
7
  '
data/README CHANGED
@@ -24,7 +24,7 @@ is customizable so you can specify exactly which fields to log.
24
24
 
25
25
  * Pure Ruby version for non-MRI versions of Ruby (or via CLOGGER_PURE=1
26
26
  in the environment). The optional C extension is loaded by default
27
- and supported under MRI 1.8.7, 1.9, 2.0 and Rubinius.
27
+ under C Ruby and under Rubinius, too.
28
28
 
29
29
  == SYNOPSIS
30
30
 
@@ -131,8 +131,8 @@ on the Rubyforge project page:
131
131
 
132
132
  * http://rubyforge.org/frs/?group_id=8896
133
133
 
134
- There is an optional C extension that should be compatible with MRI
135
- 1.8/1.9. The extensions should automatically be disabled for users of
134
+ There is an optional C extension that should be compatible with
135
+ MatzRuby. The extensions should automatically be disabled for users of
136
136
  other Ruby implementations, but be sure to let us know if that's not the
137
137
  case. No pre-built binaries are currently distributed, let us know if
138
138
  you're interested in helping with the release/support effort.
@@ -365,12 +365,12 @@ static void append_body_bytes_sent(struct clogger *c)
365
365
  rb_str_buf_cat(c->log_buf, buf, nr);
366
366
  }
367
367
 
368
- static void append_ts(struct clogger *c, const VALUE *op, struct timespec *ts)
368
+ static void append_ts(struct clogger *c, VALUE op, struct timespec *ts)
369
369
  {
370
370
  char buf[sizeof(".000000") + ((sizeof(ts->tv_sec) * 8) / 3)];
371
371
  int nr;
372
- char *fmt = RSTRING_PTR(op[1]);
373
- int ndiv = NUM2INT(op[2]);
372
+ char *fmt = RSTRING_PTR(rb_ary_entry(op, 1));
373
+ int ndiv = NUM2INT(rb_ary_entry(op, 2));
374
374
  int usec = ts->tv_nsec / 1000;
375
375
 
376
376
  nr = snprintf(buf, sizeof(buf), fmt,
@@ -379,7 +379,7 @@ static void append_ts(struct clogger *c, const VALUE *op, struct timespec *ts)
379
379
  rb_str_buf_cat(c->log_buf, buf, nr);
380
380
  }
381
381
 
382
- static void append_request_time_fmt(struct clogger *c, const VALUE *op)
382
+ static void append_request_time_fmt(struct clogger *c, VALUE op)
383
383
  {
384
384
  struct timespec now;
385
385
 
@@ -388,7 +388,7 @@ static void append_request_time_fmt(struct clogger *c, const VALUE *op)
388
388
  append_ts(c, op, &now);
389
389
  }
390
390
 
391
- static void append_time_fmt(struct clogger *c, const VALUE *op)
391
+ static void append_time_fmt(struct clogger *c, VALUE op)
392
392
  {
393
393
  struct timespec now;
394
394
  int r = clock_gettime(CLOCK_REALTIME, &now);
@@ -641,35 +641,38 @@ static void special_var(struct clogger *c, enum clogger_special var)
641
641
  static VALUE cwrite(struct clogger *c)
642
642
  {
643
643
  const VALUE ops = c->fmt_ops;
644
- const VALUE *ary = RARRAY_PTR(ops);
645
- long i = RARRAY_LEN(ops);
644
+ long i;
645
+ long len = RARRAY_LEN(ops);
646
646
  VALUE dst = c->log_buf;
647
647
 
648
648
  rb_str_set_len(dst, 0);
649
649
 
650
- for (; --i >= 0; ary++) {
651
- const VALUE *op = RARRAY_PTR(*ary);
652
- enum clogger_opcode opcode = FIX2INT(op[0]);
650
+ for (i = 0; i < len; i++) {
651
+ VALUE op = rb_ary_entry(ops, i);
652
+ enum clogger_opcode opcode = FIX2INT(rb_ary_entry(op, 0));
653
+ VALUE op1 = rb_ary_entry(op, 1);
653
654
 
654
655
  switch (opcode) {
655
656
  case CL_OP_LITERAL:
656
- rb_str_buf_append(dst, op[1]);
657
+ rb_str_buf_append(dst, op1);
657
658
  break;
658
659
  case CL_OP_REQUEST:
659
- append_request_env(c, op[1]);
660
+ append_request_env(c, op1);
660
661
  break;
661
662
  case CL_OP_RESPONSE:
662
- append_response(c, op[1]);
663
+ append_response(c, op1);
663
664
  break;
664
665
  case CL_OP_SPECIAL:
665
- special_var(c, FIX2INT(op[1]));
666
+ special_var(c, FIX2INT(op1));
666
667
  break;
667
668
  case CL_OP_EVAL:
668
- append_eval(c, op[1]);
669
+ append_eval(c, op1);
669
670
  break;
670
671
  case CL_OP_TIME_LOCAL:
671
- case CL_OP_TIME_UTC:
672
- append_time(c, opcode, op[1], op[2]);
672
+ case CL_OP_TIME_UTC: {
673
+ VALUE arg2 = rb_ary_entry(op, 2);
674
+ append_time(c, opcode, op1, arg2);
675
+ }
673
676
  break;
674
677
  case CL_OP_REQUEST_TIME:
675
678
  append_request_time_fmt(c, op);
@@ -678,7 +681,7 @@ static VALUE cwrite(struct clogger *c)
678
681
  append_time_fmt(c, op);
679
682
  break;
680
683
  case CL_OP_COOKIE:
681
- append_cookie(c, op[1]);
684
+ append_cookie(c, op1);
682
685
  break;
683
686
  }
684
687
  }
@@ -852,16 +855,15 @@ static VALUE ccall(struct clogger *c, VALUE env)
852
855
  c->cookies = Qfalse;
853
856
  rv = rb_funcall(c->app, call_id, 1, env);
854
857
  if (TYPE(rv) == T_ARRAY && RARRAY_LEN(rv) == 3) {
855
- VALUE *tmp = RARRAY_PTR(rv);
856
-
857
- c->status = tmp[0];
858
- c->headers = tmp[1];
859
- c->body = tmp[2];
858
+ c->status = rb_ary_entry(rv, 0);
859
+ c->headers = rb_ary_entry(rv, 1);
860
+ c->body = rb_ary_entry(rv, 2);
860
861
 
861
- rv = rb_ary_new4(3, tmp);
862
+ rv = rb_ary_dup(rv);
862
863
  if (c->need_resp &&
863
- ! rb_obj_is_kind_of(tmp[1], cHeaderHash)) {
864
- c->headers = rb_funcall(cHeaderHash, new_id, 1, tmp[1]);
864
+ ! rb_obj_is_kind_of(c->headers, cHeaderHash)) {
865
+ c->headers = rb_funcall(cHeaderHash, new_id, 1,
866
+ c->headers);
865
867
  rb_ary_store(rv, 1, c->headers);
866
868
  }
867
869
  } else {
@@ -919,17 +921,19 @@ static VALUE clogger_call(VALUE self, VALUE env)
919
921
 
920
922
  static void duplicate_buffers(VALUE ops)
921
923
  {
922
- long i = RARRAY_LEN(ops);
923
- VALUE *ary = RARRAY_PTR(ops);
924
+ long i;
925
+ long len = RARRAY_LEN(ops);
924
926
 
925
- for ( ; --i >= 0; ary++) {
926
- VALUE *op = RARRAY_PTR(*ary);
927
- enum clogger_opcode opcode = FIX2INT(op[0]);
927
+ for (i = 0; i < len; i++) {
928
+ VALUE op = rb_ary_entry(ops, i);
929
+ enum clogger_opcode opcode = FIX2INT(rb_ary_entry(op, 0));
928
930
 
929
931
  if (opcode == CL_OP_TIME_LOCAL || opcode == CL_OP_TIME_UTC) {
930
- Check_Type(op[2], T_STRING);
931
- op[2] = rb_str_dup(op[2]);
932
- rb_str_modify(op[2]); /* trigger copy-on-write */
932
+ VALUE buf = rb_ary_entry(op, 2);
933
+ Check_Type(buf, T_STRING);
934
+ buf = rb_str_dup(buf);
935
+ rb_str_modify(buf); /* trigger copy-on-write */
936
+ rb_ary_store(op, 2, buf);
933
937
  }
934
938
  }
935
939
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-06 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack