8000 snprintf.c · jruby/ruby@b15d33e · GitHub
[go: up one dir, main page]

Skip to content

Commit b15d33e

Browse files
author
matz
committed
snprintf.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 707a0a9 commit b15d33e

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

missing/snprintf.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,36 @@
5959

6060
#include <sys/types.h>
6161

62-
63-
# undef __P
62+
#undef __P
6463
#if defined(__STDC__)
65-
# define __P(x) x
6664
# include <stdarg.h>
6765
# if !defined(__P)
6866
# define __P(x) x
6967
# endif
7068
#else
71-
# undef __P
7269
# define __P(x) ()
73-
# define const
70+
# if !defined(const)
71+
# define const
72+
# endif
7473
# include <varargs.h>
7574
#endif
7675
#ifndef _BSD_VA_LIST_
7776
#define _BSD_VA_LIST_ va_list
7877
#endif
7978

79+
#ifdef __STDC__
80+
# include <limits.h>
81+
#else
82+
# ifndef LONG_MAX
83+
# ifdef HAVE_LIMITS_H
84+
# include <limits.h>
85+
# else
86+
/* assuming 32bit(2's compliment) long */
87+
# define LONG_MAX 2147483647
88+
# endif
89+
# endif
90+
#endif
91+
8092
#if defined(__hpux) && !defined(__GNUC__)
8193
#define const
8294
#endif
@@ -359,22 +371,13 @@ static BSD__sfvwrite(fp, uio)
359371
#define u_short unsigned short
360372
#define u_int unsigned int
361373

362-
#if !defined(__CYGWIN32__) && (defined(__hpux) && !defined(__GNUC__))
374+
#if !defined(__CYGWIN32__) && defined(__hpux) && !defined(__GNUC__)
363375
#include <stdlib.h>
364376
#endif
365377
#if defined(__hpux) && !defined(__GNUC__)
366378
#include <string.h>
367379
#endif
368380

369-
#if defined(__STDC__)
370-
# include <stdarg.h>
371-
#else
372-
# include <varargs.h>
373-
# undef __P
374-
# define __P(x) ()
375-
#endif
376-
377-
378381
/*
379382
* Flush out all the vectors defined by the given uio,
380383
* then reset it so that it can be reused.

0 commit comments

Comments
 (0)
0