mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/ruby.h: replace snprintf and vsnprintf by
ruby_snprintf and ruby_vsnprintf. [ruby-dev:40909] * configure.in: don't check snprintf(3) and vsnprintf(3). * include/ruby/missing.h: don't delare snprintf and vsnprintf. * include/ruby/ruby.h: include stdarg.h. * sprintf.c: include vsnprintf.c * vsnprintf.c: renamed from missing/vsnprintf.c. * vsnprintf.c: remove useless ifdefs. * win32/mkexports.rb: use ruby_snprintf and ruby_vsnprintf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c50406bd5
commit
b919cb1d93
7 changed files with 33 additions and 51 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
Sun Apr 4 10:04:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* include/ruby/ruby.h: replace snprintf and vsnprintf by
|
||||||
|
ruby_snprintf and ruby_vsnprintf. [ruby-dev:40909]
|
||||||
|
|
||||||
|
* configure.in: don't check snprintf(3) and vsnprintf(3).
|
||||||
|
|
||||||
|
* include/ruby/missing.h: don't delare snprintf and vsnprintf.
|
||||||
|
|
||||||
|
* include/ruby/ruby.h: include stdarg.h.
|
||||||
|
|
||||||
|
* sprintf.c: include vsnprintf.c
|
||||||
|
|
||||||
|
* vsnprintf.c: renamed from missing/vsnprintf.c.
|
||||||
|
|
||||||
|
* vsnprintf.c: remove useless ifdefs.
|
||||||
|
|
||||||
|
* win32/mkexports.rb: use ruby_snprintf and ruby_vsnprintf.
|
||||||
|
|
||||||
Sun Apr 4 09:44:01 2010 Tanaka Akira <akr@fsij.org>
|
Sun Apr 4 09:44:01 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* time.c (lt): call <=> instead of <.
|
* time.c (lt): call <=> instead of <.
|
||||||
|
|
|
@ -888,8 +888,6 @@ main()
|
||||||
ac_cv_func_times=yes
|
ac_cv_func_times=yes
|
||||||
ac_cv_func_waitpid=yes
|
ac_cv_func_waitpid=yes
|
||||||
ac_cv_func_fsync=yes
|
ac_cv_func_fsync=yes
|
||||||
ac_cv_func_snprintf=no
|
|
||||||
ac_cv_func_vsnprintf=no
|
|
||||||
ac_cv_func_seekdir=yes
|
ac_cv_func_seekdir=yes
|
||||||
ac_cv_func_telldir=yes
|
ac_cv_func_telldir=yes
|
||||||
ac_cv_func_isinf=yes
|
ac_cv_func_isinf=yes
|
||||||
|
@ -1116,7 +1114,6 @@ main()
|
||||||
rb_cv_broken_glibc_ia64_erfc=no)])
|
rb_cv_broken_glibc_ia64_erfc=no)])
|
||||||
AS_CASE([$rb_cv_broken_glibc_ia64_erfc],[yes],[ac_cv_func_erf=no])
|
AS_CASE([$rb_cv_broken_glibc_ia64_erfc],[yes],[ac_cv_func_erf=no])
|
||||||
|
|
||||||
AS_CASE(["$target_os"],[mingw*],[],[AC_REPLACE_FUNCS(vsnprintf)])
|
|
||||||
AC_REPLACE_FUNCS(dup2 memmove strerror\
|
AC_REPLACE_FUNCS(dup2 memmove strerror\
|
||||||
strchr strstr crypt flock\
|
strchr strstr crypt flock\
|
||||||
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt signbit \
|
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt signbit \
|
||||||
|
@ -1128,7 +1125,7 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot getcwd eacce
|
||||||
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
|
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
|
||||||
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
|
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
|
||||||
getpriority getrlimit setrlimit sysconf \
|
getpriority getrlimit setrlimit sysconf \
|
||||||
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp snprintf\
|
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\
|
||||||
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
|
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
|
||||||
setuid setgid daemon select_large_fdset setenv unsetenv\
|
setuid setgid daemon select_large_fdset setenv unsetenv\
|
||||||
mktime timegm gmtime_r clock_gettime gettimeofday\
|
mktime timegm gmtime_r clock_gettime gettimeofday\
|
||||||
|
|
|
@ -151,22 +151,6 @@ RUBY_EXTERN long strtol(const char *, char **, int);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined HAVE_VSNPRINTF || defined HAVE_SNPRINTF
|
|
||||||
# include <stdarg.h>
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_SNPRINTF
|
|
||||||
RUBY_EXTERN int snprintf(char *, size_t n, char const *, ...);
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_VSNPRINTF
|
|
||||||
# if _MSC_VER >= 1300
|
|
||||||
# pragma warning(disable: 4273)
|
|
||||||
# endif
|
|
||||||
RUBY_EXTERN int vsnprintf(char *, size_t n, char const *, va_list);
|
|
||||||
# if _MSC_VER >= 1300
|
|
||||||
# pragma warning(default: 4273)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
|
RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -67,6 +67,7 @@ extern "C" {
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -1403,6 +1404,13 @@ unsigned long ruby_strtoul(const char *str, char **endptr, int base);
|
||||||
|
|
||||||
#define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
|
#define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
|
||||||
|
|
||||||
|
int ruby_snprintf(char *str, size_t n, char const *fmt, ...);
|
||||||
|
int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
|
||||||
|
#undef snprintf
|
||||||
|
#undef vsnprintf
|
||||||
|
#define snprintf ruby_snprintf
|
||||||
|
#define vsnprintf ruby_vsnprintf
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#if 0
|
#if 0
|
||||||
{ /* satisfy cc-mode */
|
{ /* satisfy cc-mode */
|
||||||
|
|
|
@ -1113,10 +1113,9 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
|
||||||
# define u_quad_t unsigned LONG_LONG
|
# define u_quad_t unsigned LONG_LONG
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#undef snprintf
|
|
||||||
#define FLOATING_POINT 1
|
#define FLOATING_POINT 1
|
||||||
#define BSD__dtoa ruby_dtoa
|
#define BSD__dtoa ruby_dtoa
|
||||||
#include "missing/vsnprintf.c"
|
#include "vsnprintf.c"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
|
ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
|
||||||
|
|
|
@ -230,7 +230,6 @@ struct __suio {
|
||||||
size_t uio_resid;
|
size_t uio_resid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_SNPRINTF)
|
|
||||||
/*
|
/*
|
||||||
* Write some memory regions. Return zero on success, EOF on error.
|
* Write some memory regions. Return zero on success, EOF on error.
|
||||||
*
|
*
|
||||||
|
@ -305,7 +304,6 @@ static int BSD__sfvwrite(fp, uio)
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actual printf innards.
|
* Actual printf innards.
|
||||||
|
@ -1219,13 +1217,8 @@ exponent(p0, exp, fmtch)
|
||||||
}
|
}
|
||||||
#endif /* FLOATING_POINT */
|
#endif /* FLOATING_POINT */
|
||||||
|
|
||||||
#ifndef HAVE_VSNPRINTF
|
|
||||||
int
|
int
|
||||||
vsnprintf(str, n, fmt, ap)
|
ruby_vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
|
||||||
char *str;
|
|
||||||
size_t n;
|
|
||||||
const char *fmt;
|
|
||||||
_BSD_VA_LIST_ ap;
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FILE f;
|
FILE f;
|
||||||
|
@ -1240,22 +1233,9 @@ vsnprintf(str, n, fmt, ap)
|
||||||
*f._p = 0;
|
*f._p = 0;
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
|
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
|
|
||||||
#ifndef HAVE_SNPRINTF
|
|
||||||
int
|
int
|
||||||
#if defined(HAVE_STDARG_PROTOTYPES)
|
ruby_snprintf(char *str, size_t n, char const *fmt, ...)
|
||||||
snprintf(char *str, size_t n, char const *fmt, ...)
|
|
||||||
#else
|
|
||||||
snprintf(str, n, fmt, va_alist)
|
|
||||||
char *str, *fmt;
|
|
||||||
size_t n;
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -1264,11 +1244,7 @@ va_dcl
|
||||||
if ((int)n < 1)
|
if ((int)n < 1)
|
||||||
return (EOF);
|
return (EOF);
|
||||||
|
|
||||||
#if defined(HAVE_STDARG_PROTOTYPES)
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
#else
|
|
||||||
va_start(ap);
|
|
||||||
#endif
|
|
||||||
f._flags = __SWR | __SSTR;
|
f._flags = __SWR | __SSTR;
|
||||||
f._bf._base = f._p = (unsigned char *)str;
|
f._bf._base = f._p = (unsigned char *)str;
|
||||||
f._bf._size = f._w = n - 1;
|
f._bf._size = f._w = n - 1;
|
||||||
|
@ -1278,4 +1254,3 @@ va_dcl
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
#endif
|
|
|
@ -51,8 +51,8 @@ class Exports
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
syms["NtInitialize"] ||= "ruby_sysinit" if syms["ruby_sysinit"]
|
syms["NtInitialize"] ||= "ruby_sysinit" if syms["ruby_sysinit"]
|
||||||
syms["rb_w32_vsnprintf"] ||= "vsnprintf"
|
syms["rb_w32_vsnprintf"] ||= "ruby_vsnprintf"
|
||||||
syms["rb_w32_snprintf"] ||= "snprintf"
|
syms["rb_w32_snprintf"] ||= "ruby_snprintf"
|
||||||
@syms = syms
|
@syms = syms
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue