Skip to content

Commit 5914e57

Browse files
my_atof is deleted
strtod from mit-threads is restored and cleaned up
1 parent 67fbc4d commit 5914e57

15 files changed

Lines changed: 166 additions & 238 deletions

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ AC_CHECK_FUNCS(alarm bmove \
18251825
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \
18261826
gethostbyaddr_r gethostbyname_r getpwnam \
18271827
bfill bzero bcmp strstr strpbrk strerror \
1828-
tell atod memcpy memmove \
1828+
tell isinf memcpy memmove \
18291829
setupterm strcasecmp sighold vidattr lrand48 localtime_r gmtime_r \
18301830
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
18311831
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \

include/m_string.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ extern int strcmp(const char *, const char *);
201201
extern size_t strlen(const char *);
202202
#endif
203203
#endif
204-
#ifndef HAVE_STRNLEN
204+
#ifndef HAVE_STRNLEN
205205
extern uint strnlen(const char *s, uint n);
206206
#endif
207207

@@ -215,7 +215,9 @@ extern char *strstr(const char *, const char *);
215215
#endif
216216
extern int is_prefix(const char *, const char *);
217217

218-
/* Conversion rutins */
218+
/* Conversion routines */
219+
double my_strtod(const char *str, char **end);
220+
double my_atof(const char *nptr);
219221

220222
#ifdef USE_MY_ITOA
221223
extern char *my_itoa(int val,char *dst,int radix);

include/my_global.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
522522
#define FN_EXTCHAR '.'
523523
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
524524
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
525-
#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */
525+
#define FN_PARENTDIR ".." /* Parent directory; Must be a string */
526526
#define FN_DEVCHAR ':'
527527

528528
#ifndef FN_LIBCHAR
@@ -581,14 +581,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
581581

582582
/* Some defines of functions for portability */
583583

584-
#ifndef HAVE_ATOD
585-
#define atod atof
586-
#endif
587-
#ifdef USE_MY_ATOF
588-
#define atof my_atof
589-
extern void init_my_atof(void);
590-
extern double my_atof(const char*);
591-
#endif
592584
#undef remove /* Crashes MySQL on SCO 5.0.0 */
593585
#ifndef __WIN__
594586
#ifdef OS2
@@ -677,6 +669,10 @@ extern double my_atof(const char*);
677669
#define FLT_MAX ((float)3.40282346638528860e+38)
678670
#endif
679671

672+
#ifndef HAVE_ISINF
673+
#define isinf(X) 0
674+
#endif
675+
680676
/*
681677
Max size that must be added to a so that we know Size to make
682678
adressable obj.

libmysql/Makefile.shared

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ target_sources = libmysql.c password.c manager.c \
3232
get_password.c errmsg.c
3333

3434
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
35-
strmake.lo strend.lo \
35+
strmake.lo strend.lo strtod.lo \
3636
strnlen.lo strfill.lo is_prefix.lo \
3737
int2str.lo str2int.lo strinstr.lo strcont.lo \
3838
strcend.lo bcmp.lo ctype-latin1.lo \

sql/gstream.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int GTextReadStream::get_next_number(double *d)
101101

102102
char *endptr;
103103

104-
*d = strtod(cur, &endptr);
104+
*d = my_strtod(cur, &endptr);
105105

106106
if (endptr)
107107
{

sql/init.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ void unireg_init(ulong options)
3434

3535
current_pid=(ulong) getpid(); /* Save for later ref */
3636
init_time(); /* Init time-functions (read zone) */
37-
#ifdef USE_MY_ATOF
38-
init_my_atof(); /* use our atof */
39-
#endif
4037
#ifndef EMBEDDED_LIBRARY
4138
my_abort_hook=unireg_abort; /* Abort with close of databases */
4239
#endif

sql/item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class Item_real :public Item
441441
public:
442442
const double value;
443443
// Item_real() :value(0) {}
444-
Item_real(const char *str_arg,uint length) :value(atof(str_arg))
444+
Item_real(const char *str_arg,uint length) :value(my_atof(str_arg))
445445
{
446446
name=(char*) str_arg;
447447
decimals=(uint8) nr_of_decimals(str_arg);

sql/item_func.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,7 @@ double user_var_entry::val(my_bool *null_value)
22552255
case INT_RESULT:
22562256
return (double) *(longlong*) value;
22572257
case STRING_RESULT:
2258-
return atof(value); // This is null terminated
2258+
return my_atof(value); // This is null terminated
22592259
case ROW_RESULT:
22602260
DBUG_ASSERT(1); // Impossible
22612261
break;

sql/item_sum.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ class Item_func_group_concat : public Item_sum
735735

736736
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
737737
const char *func_name() const { return "group_concat"; }
738-
enum Type type() const { return SUM_FUNC_ITEM; }
738+
enum Type type() const { return SUM_FUNC_ITEM; }
739739
virtual Item_result result_type () const { return STRING_RESULT; }
740740
void clear();
741741
bool add();
@@ -747,7 +747,7 @@ class Item_func_group_concat : public Item_sum
747747
double val()
748748
{
749749
String *res; res=val_str(&str_value);
750-
return res ? atof(res->c_ptr()) : 0.0;
750+
return res ? my_atof(res->c_ptr()) : 0.0;
751751
}
752752
longlong val_int()
753753
{

sql/sql_analyse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
225225
info->decimals++;
226226
if (str == end)
227227
{
228-
info->dval = atod(begin);
228+
info->dval = my_atof(begin);
229229
return 1;
230230
}
231231
}

0 commit comments

Comments
 (0)