From dda5dc00cff334cac373096d444a0fd59e716124 Mon Sep 17 00:00:00 2001 From: ocean Date: Mon, 12 Sep 2005 10:44:21 +0000 Subject: * array.c: moved to ANSI function style from K&R function style. (used protoize on windows, so still K&R remains on #ifdef part of other platforms. And `foo _((boo))' stuff is still there) [ruby-dev:26975] * bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c, prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c, regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c, sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c, version.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- pack.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) (limited to 'pack.c') diff --git a/pack.c b/pack.c index a5524bcca0..5b4f417b14 100644 --- a/pack.c +++ b/pack.c @@ -135,8 +135,7 @@ define_swapx(f,float) #else #if SIZEOF_LONG == 4 /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_LONG */ static double -swapd(d) - const double d; +swapd(const double d) { double dtmp = d; unsigned long utmp[2]; @@ -334,8 +333,7 @@ endian() unsigned long rb_big2ulong_pack _((VALUE x)); static unsigned long -num2i32(x) - VALUE x; +num2i32(VALUE x) { x = rb_to_int(x); /* is nil OK? (should not) */ @@ -438,8 +436,7 @@ static unsigned long utf8_to_uv _((char*,long*)); */ static VALUE -pack_pack(ary, fmt) - VALUE ary, fmt; +pack_pack(VALUE ary, VALUE fmt) { static char *nul10 = "\0\0\0\0\0\0\0\0\0\0"; static char *spc10 = " "; @@ -1008,11 +1005,7 @@ static char b64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static void -encodes(str, s, len, type) - VALUE str; - char *s; - long len; - int type; +encodes(VALUE str, char *s, long len, int type) { char *buff = ALLOCA_N(char, len * 4 / 3 + 6); long i = 0; @@ -1053,9 +1046,7 @@ encodes(str, s, len, type) static char hex_table[] = "0123456789ABCDEF"; static void -qpencode(str, from, len) - VALUE str, from; - long len; +qpencode(VALUE str, VALUE from, long len) { char buff[1024]; long i = 0, n = 0, prev = EOF; @@ -1108,8 +1099,7 @@ qpencode(str, from, len) } static inline int -hex2num(c) - char c; +hex2num(char c) { switch (c) { case '0': case '1': case '2': case '3': case '4': @@ -1149,10 +1139,7 @@ hex2num(c) #define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil) static VALUE -infected_str_new(ptr, len, str) - const char *ptr; - long len; - VALUE str; +infected_str_new(const char *ptr, long len, VALUE str) { VALUE s = rb_str_new(ptr, len); @@ -1299,8 +1286,7 @@ infected_str_new(ptr, len, str) */ static VALUE -pack_unpack(str, fmt) - VALUE str, fmt; +pack_unpack(VALUE str, VALUE fmt) { static char *hexdigits = "0123456789abcdef0123456789ABCDEFx"; char *s, *send; @@ -1990,9 +1976,7 @@ pack_unpack(str, fmt) #define BYTEWIDTH 8 static int -uv_to_utf8(buf, uv) - char *buf; - unsigned long uv; +uv_to_utf8(char *buf, unsigned long uv) { if (uv <= 0x7f) { buf[0] = (char)uv; @@ -2047,9 +2031,7 @@ static const long utf8_limits[] = { }; static unsigned long -utf8_to_uv(p, lenp) - char *p; - long *lenp; +utf8_to_uv(char *p, long *lenp) { int c = *p++ & 0xff; unsigned long uv = c; @@ -2099,7 +2081,7 @@ utf8_to_uv(p, lenp) } void -Init_pack() +Init_pack(void) { rb_define_method(rb_cArray, "pack", pack_pack, 1); rb_define_method(rb_cString, "unpack", pack_unpack, 1); -- cgit v1.2.3