Граф коммитов

215 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 33844f3096
Prefer ANSI-style prototypes over old K&R-style definitions 2021-10-27 10:16:52 +09:00
Nobuyoshi Nakada 80c1faf076
Use C99-defined signbit macro 2021-08-27 12:42:23 +09:00
Nobuyoshi Nakada 04be8e84db
Use C99-defined macros to classify a floating-point number 2021-08-27 12:41:30 +09:00
Nobuyoshi Nakada 2d67027448 Removed missing/dup2.c
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9.  Also the code in this
file is MT-unsafe.
2021-05-10 15:59:23 +09:00
Nobuyoshi Nakada 3acc81d9e4 Fixed race in dtoa [Bug #17612]
Fixed the race condition when replacing `freelist` entry with its
chained next element.  At acquiring an entry, hold the entry once
with the special value, then release by replacing it with the next
element again after acquired.  If another thread is holding the
same entry at that time, spinning until the entry gets released.

Co-Authored-By: Koichi Sasada <ko1@atdot.net>
2021-02-10 19:44:47 +09:00
Nobuyoshi Nakada 2adbf01ae1
dtoa.c: make thread-safe by using atomic CAS 2021-01-10 18:19:53 +09:00
Nobuyoshi Nakada 34d02631e7
dtoa.c: constified
clang seems to locate never modified local data in the const
segment implicitly.
2021-01-10 16:42:36 +09:00
Nobuyoshi Nakada 63abb5c227
dtoa.c: make compilable independently
Except for `-Dxmalloc=malloc -Dxfree=free`.
2021-01-10 16:28:58 +09:00
Nobuyoshi Nakada 4d2ad8d737
Removed obsolete autoconf checks
Use regular `AC_CHECK_MEMBERS` instead of:
* `AC_STRUCT_ST_BLKSIZE`
* `AC_STRUCT_ST_BLOCKS`
* `AC_STRUCT_ST_RDEV`
2020-12-12 17:23:44 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Sorah Fukumori 7ccb7a992d
[DOC] explicit_bzero exists in modern Linux
[ci skip]
2020-04-26 02:00:45 +09:00
卜部昌平 4ff3f20540 add #include guard hack
According to MSVC manual (*1), cl.exe can skip including a header file
when that:

- contains #pragma once, or
- starts with #ifndef, or
- starts with #if ! defined.

GCC has a similar trick (*2), but it acts more stricter (e. g. there
must be _no tokens_ outside of #ifndef...#endif).

Sun C lacked #pragma once for a looong time.  Oracle Developer Studio
12.5 finally implemented it, but we cannot assume such recent version.

This changeset modifies header files so that each of them include
strictly one #ifndef...#endif.  I believe this is the most portable way
to trigger compiler optimizations. [Bug #16770]

*1: https://docs.microsoft.com/en-us/cpp/preprocessor/once
*2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
2020-04-13 16:06:00 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
卜部昌平 8184adabe5 internal/stdbool.h rework
Noticed that internal/stdbool.h and addr2line.c are the only two place
where missing/stdbool.h is included.  Why not delete the file so that
we can merge internal/stdbool.h and missing/stdbool.h into one.
2019-12-26 20:45:12 +09:00
Nobuyoshi Nakada e954be14d0
Get rid of false positive misspellings
[Bug #16437]
2019-12-24 10:33:32 +09:00
Nobuyoshi Nakada 209164e44f
Renamed assembly file like as e64f71f812 2019-11-18 18:42:22 +09:00
Yusuke Endoh cb14c4a535 missing/setproctitle.c: remove nonsense NULL check
If fmt is NULL, ptitle is uninitialized and used.
SETPROCTITLE(3bsd) says "If fmt is NULL, the process title is restored",
but looks like the feature is not implemented in missing/setproctitle.c.
At least the source code of ruby does not pass NULL to the function.
So I assume this function requires non-NULL fmt.

This issue was found by Coverity Scan.
2019-10-12 21:14:20 +09:00
Yusuke Endoh d76be10df1 missing/memcmp.c: suppress a `-Wparentheses` warning 2019-08-19 14:43:55 +09:00
David CARLIER 28267cea08 NetBSD native support of explicit_bzero's like feature (#2145) 2019-08-17 14:17:30 +09:00
nobu a67788b2f3 Split procstat_vm.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:13 +00:00
nobu 18365f9e83 Split mt19937.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:12 +00:00
nobu 867338c36e Split dtoa.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:11 +00:00
k0kubun d8931259d0 internal.h: unify our own stdtbool.h implementation
because we had another one in missing/stdbool.h as well.
Assuming that _Bool does not exist when stdbool.h is absent, I'm in
favor of r57462 implementation rather than r61326.

Note that Visual Studio 2013 has stdbool.h and thus r57462's commit
message is somewhat misleading. This missing/stdbool.h is for Visual
Studio 2012 or older, and for Oracle Solaris Studio 12.2 or older because
it's added in 12.3 https://docs.oracle.com/cd/E24457_01/html/E21987/gkeza.html.

missing/stdbool.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06 14:53:43 +00:00
shyouhei 4680cecd57 [ci skip] tabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20 04:18:09 +00:00
shyouhei 782236e3bd add missing/nan.c
instead of scattering #ifdef HAVE_NANF here and there define our
own nan() unless defined elsewhere.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20 03:16:59 +00:00
ngoto b75828fdfa Support C89 if possible
* addr2line.c: Because stdbool.h is a C99 feature, compile error
  occurs with some old compilers without specifying C99 options.
  Fix compile error with Oracle Solaris Studio 12.4 on Solaris 10.
  [Bug #14200] [ruby-dev:50366]

* missing/stdbool.h: Alternative of stdbool.h for C89 compilers.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18 16:17:17 +00:00
rhe 0b845a8458 string.c: fix memory leak in String#crypt
Use ALLOCV to allocate struct crypt_data for slightly cleaner and less
error-prone code. It is currently possible it leaks when an invalid
argument is passed to String#crypt or rb_str_new_cstr() fails to
allocate memory.

SIZEOF_CRYPT_DATA macro in missing/crypt.h is removed since it is not
used any longer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12 15:55:04 +00:00
hsbt 0e2d2e6a79 Drop to support NaCl platform.
Because NaCl and PNaCl are already sunset status.
  see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160

  configure.ac: Patch for this file was provided by @nobu.

  [Feature #14041][ruby-core:83497][fix GH-1726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 05:56:25 +00:00
nobu 92261511b6 string.c: for small crypt_data
* string.c (rb_str_crypt): struct crypt_data defined in
  missing/crypt.h is small enough.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 06:55:09 +00:00
nobu 126aba8587 fix tgamma for inifity
* configure.in: do not use buggy tgamma() of mingw.

* missing/tgamma.c (tgamma): merge fix for inifity from
  ruby_tgamma.  since msvcr120.dll and later have tgamma, this
  implementation will not be used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-12 16:12:46 +00:00
nobu 05ea264611 tgamma.c: unify versions with/without lgamma_r
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-12 16:01:17 +00:00
rhe 70c9bb4b81 Remove missing/strtol.c
It is never used. We don't need it anyway as it's part of C89 which is
our current minimum requirement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 06:03:12 +00:00
nobu 08cf4cecd5 get rid of sprintf
* missing/strerror.c (strerror): use snprintf instead of sprintf.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26 09:28:48 +00:00
nobu 9b454bfaf3 rubystub
* rubystub.c: generalize win32/stub.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-20 02:20:34 +00:00
hsbt 0b8590724d * missing/strl{cat,cpy}.c: Update latest upstream files.
[Misc #12205][ruby-core:74487]
* LEGAL: Update license for missing/strl{cat,cpy}.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-21 13:27:02 +00:00
nobu df8c48a3f9 Use LONG_LONG
* missing/crypt.h (B64): use LONG_LONG instead of long long
  directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-29 04:37:12 +00:00
nobu b1b1f3ded2 des_tables.c: generation rule
* defs/gmake.mk (missing/des_tables.c): move the recipe from
  common.mk.  this is less common.

* missing/crypt.c (init_des): if des_tables.c is empty, initialize
  DES tables at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-04 02:40:04 +00:00
nobu 40c3c3ec6c crypt.h: remove initialized
* missing/crypt.h (struct crypt_data): remove unnecessary member
  "initialized".
* missing/crypt.c (des_setkey_r): nothing to be initialized in
  crypt_data.
* configure.in (struct crypt_data): check for "initialized" in
  struct crypt_data, which may be only in glibc, and isn't on AIX
  at least.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-04 01:54:54 +00:00
nobu 80cd6b8757 crypt.c: suppress warnings
* missing/crypt.c (SPE): make unsigned so that literal integers do
  not exceed 32bit signed integer limit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 03:05:40 +00:00
nobu 9334bb3075 crypt.c: fix syntax error on mswin
* missing/crypt.c (constdatablock): fix error on mswin. Visual C
  does not accept an empty initializer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 02:30:43 +00:00
nobu 5f225f3114 crypt.c: unused functions
* missing/crypt.c: suppress unused non-reentrant functions, by
  macro USE_NONREENTRANT_CRYPT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 13:38:59 +00:00
nobu 691556d778 crypt.h: get rid of conflict
* missing/crypt.h: move crypt.h to get rid of conflict with the
  system header.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 10:24:10 +00:00
nobu a8bfa9bdf1 use system crypt
* configure.in: revert r55237.  replace crypt, not crypt_r, and
  check if crypt is broken more.
* missing/crypt.c: move crypt_r.c
* string.c (rb_str_crypt): use crypt_r if provided by the system.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 06:58:21 +00:00
nobu 1258bc559b des_tables.c
* missing/crypt_r.c: initialize DES tables statically.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 06:05:21 +00:00
nobu 9cfc17a210 crypt_r.c: fix out of bounds access
* missing/crypt_r.c (a64toi): initialize statically and fix out of
  bounds access when salt is not 7bit clean.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 05:07:55 +00:00
nobu 2a27b6c851 crypt_r.c: DES tables
* missing/crypt_r.c (des_tables): move sharable DES constant
  tables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 05:00:55 +00:00
nobu bc6db9a585 crypt_r.c: remove casts
* missing/crypt_r.c: consitify and remove unnecessary pointer
  casts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 04:20:40 +00:00
nobu 6593e0fe54 crypt_r.c: adjust style
* missing/crypt_r.c: adjust style to BSD as the original.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 00:52:59 +00:00
nobu 3c31685e11 use crypt_r
* string.c (rb_str_crypt): use reentrant crypt_r.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 00:48:08 +00:00