Skip to content

Commit

Permalink
Remove some unnecessary imports and use SPDX for license
Browse files Browse the repository at this point in the history
Signed-off-by: Madelyn Olson <[email protected]>
  • Loading branch information
madolson authored Nov 18, 2024
1 parent 129fdbf commit 43696b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 49 deletions.
12 changes: 3 additions & 9 deletions deps/fast_float_c_interface/fast_float_strtod.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
/*
* Copyright (c) 2024-present, Valkey contributors
* Copyright Valkey Contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
* SPDX-License-Identifier: BSD 3-Clause
*/

#include "../fast_float/fast_float.h"
#include <cerrno>
Expand Down
30 changes: 10 additions & 20 deletions src/unit/test_valkey_strtod.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
/*
* Copyright (c) 2024-present, Valkey contributors
* Copyright Valkey Contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SPDX-License-Identifier: BSD 3-Clause
*/


#include "../valkey_strtod.h"
#include "assert.h"
#include "errno.h"
#include "math.h"
#include "test_help.h"
Expand All @@ -23,28 +15,26 @@ int test_valkey_strtod(int argc, char **argv, int flags) {
UNUSED(argv);
UNUSED(flags);

#ifdef USE_FAST_FLOAT
double value = 0;
errno = 0;
valkey_strtod("231.2341234", &value);
assert(value == 231.2341234);
assert(errno == 0);
TEST_ASSERT(value == 231.2341234);
TEST_ASSERT(errno == 0);

value = 0;
valkey_strtod("+inf", &value);
assert(isinf(value));
assert(errno == 0);
TEST_ASSERT(isinf(value));
TEST_ASSERT(errno == 0);

value = 0;
valkey_strtod("-inf", &value);
assert(isinf(value));
assert(errno == 0);
TEST_ASSERT(isinf(value));
TEST_ASSERT(errno == 0);

value = 0;
valkey_strtod("inf", &value);
assert(isinf(value));
assert(errno == 0);
#endif
TEST_ASSERT(isinf(value));
TEST_ASSERT(errno == 0);

return 0;
}
20 changes: 0 additions & 20 deletions src/valkey_strtod.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
/*
* Copyright (c) 2024-present, Valkey contributors
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FAST_FLOAT_STRTOD_H
#define FAST_FLOAT_STRTOD_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef USE_FAST_FLOAT

#include "errno.h"
Expand Down Expand Up @@ -59,8 +43,4 @@ static inline const char *valkey_strtod(const char *str, double *value) {

#endif

#ifdef __cplusplus
}
#endif

#endif // FAST_FLOAT_STRTOD_H

0 comments on commit 43696b5

Please sign in to comment.