mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* 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
This commit is contained in:
parent
51e25545ae
commit
dda5dc00cf
44 changed files with 2211 additions and 5308 deletions
44
sprintf.c
44
sprintf.c
|
@ -15,22 +15,14 @@
|
|||
#include "ruby.h"
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#define va_init_list(a,b) va_start(a,b)
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#define va_init_list(a,b) va_start(a)
|
||||
#endif
|
||||
|
||||
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
|
||||
|
||||
static void fmt_setup _((char*,int,int,int,int));
|
||||
|
||||
static char*
|
||||
remove_sign_bits(str, base)
|
||||
char *str;
|
||||
int base;
|
||||
remove_sign_bits(char *str, int base)
|
||||
{
|
||||
char *s, *t;
|
||||
|
||||
|
@ -61,9 +53,7 @@ remove_sign_bits(str, base)
|
|||
}
|
||||
|
||||
static char
|
||||
sign_bits(base, p)
|
||||
int base;
|
||||
const char *p;
|
||||
sign_bits(int base, const char *p)
|
||||
{
|
||||
char c = '.';
|
||||
|
||||
|
@ -241,18 +231,13 @@ sign_bits(base, p)
|
|||
*/
|
||||
|
||||
VALUE
|
||||
rb_f_sprintf(argc, argv)
|
||||
int argc;
|
||||
const VALUE *argv;
|
||||
rb_f_sprintf(int argc, const VALUE *argv)
|
||||
{
|
||||
return rb_str_format(argc - 1, argv + 1, GETNTHARG(0));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_str_format(argc, argv, fmt)
|
||||
int argc;
|
||||
const VALUE *argv;
|
||||
VALUE fmt;
|
||||
rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
||||
{
|
||||
const char *p, *end;
|
||||
char *buf;
|
||||
|
@ -805,10 +790,7 @@ rb_str_format(argc, argv, fmt)
|
|||
}
|
||||
|
||||
static void
|
||||
fmt_setup(buf, c, flags, width, prec)
|
||||
char *buf;
|
||||
int c;
|
||||
int flags, width, prec;
|
||||
fmt_setup(char *buf, int c, int flags, int width, int prec)
|
||||
{
|
||||
*buf++ = '%';
|
||||
if (flags & FSHARP) *buf++ = '#';
|
||||
|
@ -852,9 +834,7 @@ fmt_setup(buf, c, flags, width, prec)
|
|||
#include "missing/vsnprintf.c"
|
||||
|
||||
static int
|
||||
ruby__sfvwrite(fp, uio)
|
||||
register rb_printf_buffer *fp;
|
||||
register struct __suio *uio;
|
||||
ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
|
||||
{
|
||||
struct __siov *iov;
|
||||
VALUE result = (VALUE)fp->_bf._base;
|
||||
|
@ -880,9 +860,7 @@ ruby__sfvwrite(fp, uio)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_vsprintf(fmt, ap)
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
rb_vsprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
rb_printf_buffer f;
|
||||
VALUE result;
|
||||
|
@ -903,18 +881,12 @@ rb_vsprintf(fmt, ap)
|
|||
}
|
||||
|
||||
VALUE
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
rb_sprintf(const char *format, ...)
|
||||
#else
|
||||
rb_sprintf(format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
VALUE result;
|
||||
va_list ap;
|
||||
|
||||
va_init_list(ap, format);
|
||||
va_start(ap, format);
|
||||
result = rb_vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue