mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Perform inconsequential code cleanup
This commit is contained in:
parent
929478c524
commit
decf216655
52 changed files with 326 additions and 442 deletions
27
third_party/gdtoa/atof.c
vendored
27
third_party/gdtoa/atof.c
vendored
|
@ -1,27 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
/**
|
||||
* Converts string to double.
|
||||
*/
|
||||
double atof(const char *s) {
|
||||
return strtod(s, NULL);
|
||||
}
|
39
third_party/gdtoa/lock.c
vendored
39
third_party/gdtoa/lock.c
vendored
|
@ -1,39 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/gdtoa/lock.h"
|
||||
|
||||
static pthread_mutex_t __gdtoa_lock_obj;
|
||||
static pthread_mutex_t __gdtoa_lock1_obj;
|
||||
|
||||
int(__gdtoa_lock)(void) {
|
||||
return pthread_mutex_lock(&__gdtoa_lock_obj);
|
||||
}
|
||||
|
||||
int(__gdtoa_unlock)(void) {
|
||||
return pthread_mutex_unlock(&__gdtoa_lock_obj);
|
||||
}
|
||||
|
||||
int(__gdtoa_lock1)(void) {
|
||||
return pthread_mutex_lock(&__gdtoa_lock1_obj);
|
||||
}
|
||||
|
||||
int(__gdtoa_unlock1)(void) {
|
||||
return pthread_mutex_unlock(&__gdtoa_lock1_obj);
|
||||
}
|
27
third_party/gdtoa/lock.h
vendored
27
third_party/gdtoa/lock.h
vendored
|
@ -1,27 +0,0 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
||||
#include "libc/intrin/nopl.internal.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int __gdtoa_lock(void);
|
||||
int __gdtoa_unlock(void);
|
||||
int __gdtoa_lock1(void);
|
||||
int __gdtoa_unlock1(void);
|
||||
|
||||
#ifdef _NOPL0
|
||||
#define __gdtoa_lock() _NOPL0("__threadcalls", __gdtoa_lock)
|
||||
#define __gdtoa_unlock() _NOPL0("__threadcalls", __gdtoa_unlock)
|
||||
#define __gdtoa_lock1() _NOPL0("__threadcalls", __gdtoa_lock1)
|
||||
#define __gdtoa_unlock1() _NOPL0("__threadcalls", __gdtoa_unlock1)
|
||||
#else
|
||||
#define __gdtoa_lock() (__threaded ? __gdtoa_lock() : 0)
|
||||
#define __gdtoa_unlock() (__threaded ? __gdtoa_unlock() : 0)
|
||||
#define __gdtoa_lock1() (__threaded ? __gdtoa_lock1() : 0)
|
||||
#define __gdtoa_unlock1() (__threaded ? __gdtoa_unlock1() : 0)
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_ */
|
53
third_party/gdtoa/misc.c
vendored
53
third_party/gdtoa/misc.c
vendored
|
@ -32,11 +32,58 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#include "third_party/gdtoa/gdtoa.internal.h"
|
||||
#include "third_party/gdtoa/lock.h"
|
||||
/* clang-format off */
|
||||
|
||||
static ThInfo TI0;
|
||||
static pthread_mutex_t __gdtoa_lock_obj;
|
||||
static pthread_mutex_t __gdtoa_lock1_obj;
|
||||
|
||||
static void
|
||||
__gdtoa_lock(void)
|
||||
{
|
||||
if (!__threaded)
|
||||
return;
|
||||
pthread_mutex_lock(&__gdtoa_lock_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_unlock(void)
|
||||
{
|
||||
if (!__threaded)
|
||||
return;
|
||||
pthread_mutex_unlock(&__gdtoa_lock_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_initlock(void)
|
||||
{
|
||||
pthread_mutex_init(&__gdtoa_lock_obj, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_lock1(void)
|
||||
{
|
||||
if (!__threaded)
|
||||
return;
|
||||
pthread_mutex_lock(&__gdtoa_lock1_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_unlock1(void)
|
||||
{
|
||||
if (!__threaded)
|
||||
return;
|
||||
pthread_mutex_unlock(&__gdtoa_lock1_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_initlock1(void)
|
||||
{
|
||||
pthread_mutex_init(&__gdtoa_lock1_obj, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
__gdtoa_Brelease(Bigint *rv)
|
||||
|
@ -63,7 +110,11 @@ __gdtoa_Bclear(void)
|
|||
__attribute__((__constructor__)) static void
|
||||
__gdtoa_Binit(void)
|
||||
{
|
||||
__gdtoa_initlock();
|
||||
__gdtoa_initlock1();
|
||||
atexit(__gdtoa_Bclear);
|
||||
pthread_atfork(__gdtoa_lock1, __gdtoa_unlock1, __gdtoa_initlock1);
|
||||
pthread_atfork(__gdtoa_lock, __gdtoa_unlock, __gdtoa_initlock);
|
||||
}
|
||||
|
||||
static ThInfo *
|
||||
|
|
44
third_party/gdtoa/strtold.c
vendored
44
third_party/gdtoa/strtold.c
vendored
|
@ -1,44 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ The author of this software is David M. Gay. │
|
||||
│ Please send bug reports to David M. Gay <dmg@acm.org> │
|
||||
│ or Justine Tunney <jtunney@gmail.com> │
|
||||
│ │
|
||||
│ Copyright (C) 1998, 1999 by Lucent Technologies │
|
||||
│ All Rights Reserved │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and distribute this software and │
|
||||
│ its documentation for any purpose and without fee is hereby │
|
||||
│ granted, provided that the above copyright notice appear in all │
|
||||
│ copies and that both that the copyright notice and this │
|
||||
│ permission notice and warranty disclaimer appear in supporting │
|
||||
│ documentation, and that the name of Lucent or any of its entities │
|
||||
│ not be used in advertising or publicity pertaining to │
|
||||
│ distribution of the software without specific, written prior │
|
||||
│ permission. │
|
||||
│ │
|
||||
│ LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, │
|
||||
│ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. │
|
||||
│ IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY │
|
||||
│ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES │
|
||||
│ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER │
|
||||
│ IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, │
|
||||
│ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF │
|
||||
│ THIS SOFTWARE. │
|
||||
│ │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
/**
|
||||
* Converts string to long double.
|
||||
*/
|
||||
long double strtold(const char *s, char **endptr) {
|
||||
long double x;
|
||||
strtorx(s, endptr, FPI_Round_near, &x);
|
||||
return x;
|
||||
}
|
||||
|
||||
__weak_reference(strtold, strtold_l);
|
27
third_party/gdtoa/wcstod.c
vendored
27
third_party/gdtoa/wcstod.c
vendored
|
@ -1,27 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/locale.h"
|
||||
|
||||
double wcstod(const wchar_t *nptr, wchar_t **endptr) {
|
||||
assert(!"not implemented");
|
||||
abort();
|
||||
}
|
28
third_party/gdtoa/wcstof.c
vendored
28
third_party/gdtoa/wcstof.c
vendored
|
@ -1,28 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/locale.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
float wcstof(const wchar_t *nptr, wchar_t **endptr) {
|
||||
assert(!"not implemented");
|
||||
abort();
|
||||
}
|
30
third_party/gdtoa/wcstold.c
vendored
30
third_party/gdtoa/wcstold.c
vendored
|
@ -1,30 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/locale.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
long double wcstold(const wchar_t *nptr, wchar_t **endptr) {
|
||||
assert(!"not implemented");
|
||||
abort();
|
||||
}
|
||||
|
||||
__weak_reference(strtold, strtold_l);
|
1
third_party/lua/lunix.c
vendored
1
third_party/lua/lunix.c
vendored
|
@ -38,6 +38,7 @@
|
|||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/calls/struct/winsize.h"
|
||||
#include "libc/calls/ucontext.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/dns/dns.h"
|
||||
#include "libc/errno.h"
|
||||
|
|
3
third_party/mbedtls/net_sockets.c
vendored
3
third_party/mbedtls/net_sockets.c
vendored
|
@ -15,8 +15,10 @@
|
|||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/mbedtls/net_sockets.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dns/dns.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/sock/select.h"
|
||||
|
@ -31,7 +33,6 @@
|
|||
#include "libc/sysv/consts/sock.h"
|
||||
#include "libc/sysv/consts/sol.h"
|
||||
#include "third_party/mbedtls/error.h"
|
||||
#include "third_party/mbedtls/net_sockets.h"
|
||||
#include "third_party/mbedtls/ssl.h"
|
||||
|
||||
#define IS_EINTR(ret) ((ret) == EINTR)
|
||||
|
|
1
third_party/mbedtls/test/lib.c
vendored
1
third_party/mbedtls/test/lib.c
vendored
|
@ -97,6 +97,7 @@ void mbedtls_test_platform_teardown(void) {
|
|||
}
|
||||
|
||||
wontreturn void exit(int rc) {
|
||||
if (rc) fprintf(stderr, "mbedtls test exit() called with %d\n", rc);
|
||||
if (rc) xwrite(1, output, appendz(output).i);
|
||||
free(output);
|
||||
output = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue