Skip to content

Commit 444ac66

Browse files
author
Davi Arnaut
committed
WL#5498: Remove dead and unused source code
Remove workarounds for ancient systems. --BZR-- revision-id: [email protected] property-branch-nick: 5498-trunk property-file-info: ld7:file_id62:sp1f-default.c-19700101030959-yapqvlw42xojx5avf7fykpwrwpf3yvtz7:message51:Make cast more explicit to ensure a correct offset.4:path15:mysys/default.cee testament3-sha1: 432da5d1d74818fbd6c62bdd7942d3ae80fe8b91
1 parent 14348e0 commit 444ac66

29 files changed

Lines changed: 94 additions & 117 deletions

include/m_string.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ extern char _dig_vec_lower[];
9090
#ifndef strmov
9191
#define strmov_overlapp(A,B) strmov(A,B)
9292
#define strmake_overlapp(A,B,C) strmake(A,B,C)
93-
#endif
94-
95-
#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */
96-
#define memcpy_fixed(A,B,C) bmove((A),(B),(C))
97-
#else
98-
#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
9993
#endif
10094

10195
/* Prototypes for string functions */

include/my_global.h

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,6 @@ C_MODE_END
341341
#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"
342342
#endif
343343

344-
345-
/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
346-
#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_MINOR__ == 8)
347-
#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */
348-
#define __LONG_MAX__ 2147483647
349-
#endif
350-
351-
/* egcs 1.1.2 has a problem with memcpy on Alpha */
352-
#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
353-
#define BAD_MEMCPY
354-
#endif
355-
356344
#if defined(_lint) && !defined(lint)
357345
#define lint
358346
#endif
@@ -1263,8 +1251,8 @@ do { doubleget_union _tmp; \
12631251
((uchar*) &def_temp)[7]=(M)[0];\
12641252
(V) = def_temp; } while(0)
12651253
#else
1266-
#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
1267-
#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float))
1254+
#define float4get(V,M) memcpy(&V, (M), sizeof(float))
1255+
#define float4store(V,M) memcpy(V, (&M), sizeof(float))
12681256

12691257
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
12701258
#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
@@ -1334,12 +1322,12 @@ do { doubleget_union _tmp; \
13341322
*(((char*)T)+1)=(((A) >> 16));\
13351323
*(((char*)T)+0)=(((A) >> 24)); } while(0)
13361324

1337-
#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
1338-
#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float))
1339-
#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
1340-
#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
1341-
#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
1342-
#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
1325+
#define floatget(V,M) memcpy(&V, (M), sizeof(float))
1326+
#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float))
1327+
#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
1328+
#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
1329+
#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
1330+
#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
13431331

13441332
#else
13451333

@@ -1350,15 +1338,15 @@ do { doubleget_union _tmp; \
13501338
#define shortstore(T,V) int2store(T,V)
13511339
#define longstore(T,V) int4store(T,V)
13521340
#ifndef floatstore
1353-
#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float))
1354-
#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(float))
1341+
#define floatstore(T,V) memcpy((T), (void *) (&V), sizeof(float))
1342+
#define floatget(V,M) memcpy(&V, (M), sizeof(float))
13551343
#endif
13561344
#ifndef doubleget
1357-
#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
1358-
#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
1345+
#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
1346+
#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
13591347
#endif /* doubleget */
1360-
#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
1361-
#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
1348+
#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
1349+
#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
13621350

13631351
#endif /* WORDS_BIGENDIAN */
13641352

mysys/default.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
575575
void free_defaults(char **argv)
576576
{
577577
MEM_ROOT ptr;
578-
memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
578+
memcpy(&ptr, ((char *) argv) - sizeof(ptr), sizeof(ptr));
579579
free_root(&ptr,MYF(0));
580580
}
581581

mysys/my_pthread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void sigwait_setup(sigset_t *set)
138138

139139
sact.sa_flags = 0;
140140
sact.sa_handler = px_handle_sig;
141-
memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
141+
memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */
142142
sigemptyset(&unblock_mask);
143143
pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set);
144144

@@ -164,7 +164,7 @@ void sigwait_setup(sigset_t *set)
164164
}
165165
}
166166
}
167-
memcpy_fixed(&sigwait_set,set,sizeof(*set));
167+
memcpy(&sigwait_set, set, sizeof(*set));
168168
pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0);
169169
pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0);
170170
}
@@ -252,7 +252,7 @@ void *sigwait_thread(void *set_arg)
252252
struct sigaction sact;
253253
sact.sa_flags = 0;
254254
sact.sa_handler = sigwait_handle_sig;
255-
memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
255+
memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */
256256
sigemptyset(&pending_set);
257257

258258
for (i = 1; i <= sizeof(pending_set)*8; i++)

sql/field.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,7 +4143,7 @@ int Field_float::store(double nr)
41434143
}
41444144
else
41454145
#endif
4146-
memcpy_fixed(ptr,(uchar*) &j,sizeof(j));
4146+
memcpy(ptr, &j, sizeof(j));
41474147
return error;
41484148
}
41494149

@@ -4166,7 +4166,7 @@ double Field_float::val_real(void)
41664166
}
41674167
else
41684168
#endif
4169-
memcpy_fixed((uchar*) &j,ptr,sizeof(j));
4169+
memcpy(&j, ptr, sizeof(j));
41704170
return ((double) j);
41714171
}
41724172

@@ -4180,7 +4180,7 @@ longlong Field_float::val_int(void)
41804180
}
41814181
else
41824182
#endif
4183-
memcpy_fixed((uchar*) &j,ptr,sizeof(j));
4183+
memcpy(&j, ptr, sizeof(j));
41844184
return (longlong) rint(j);
41854185
}
41864186

@@ -4197,7 +4197,7 @@ String *Field_float::val_str(String *val_buffer,
41974197
}
41984198
else
41994199
#endif
4200-
memcpy_fixed((uchar*) &nr,ptr,sizeof(nr));
4200+
memcpy(&nr, ptr, sizeof(nr));
42014201

42024202
uint to_length=max(field_length,70);
42034203
val_buffer->alloc(to_length);
@@ -4235,8 +4235,8 @@ int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr)
42354235
else
42364236
#endif
42374237
{
4238-
memcpy_fixed(&a,a_ptr,sizeof(float));
4239-
memcpy_fixed(&b,b_ptr,sizeof(float));
4238+
memcpy(&a, a_ptr, sizeof(float));
4239+
memcpy(&b, b_ptr, sizeof(float));
42404240
}
42414241
return (a < b) ? -1 : (a > b) ? 1 : 0;
42424242
}
@@ -4253,7 +4253,7 @@ void Field_float::sort_string(uchar *to,uint length __attribute__((unused)))
42534253
}
42544254
else
42554255
#endif
4256-
memcpy_fixed(&nr,ptr,sizeof(float));
4256+
memcpy(&nr, ptr, sizeof(float));
42574257

42584258
uchar *tmp= to;
42594259
if (nr == (float) 0.0)
@@ -4264,7 +4264,7 @@ void Field_float::sort_string(uchar *to,uint length __attribute__((unused)))
42644264
else
42654265
{
42664266
#ifdef WORDS_BIGENDIAN
4267-
memcpy_fixed(tmp,&nr,sizeof(nr));
4267+
memcpy(tmp, &nr, sizeof(nr));
42684268
#else
42694269
tmp[0]= ptr[3]; tmp[1]=ptr[2]; tmp[2]= ptr[1]; tmp[3]=ptr[0];
42704270
#endif
@@ -7442,7 +7442,7 @@ double Field_blob::val_real(void)
74427442
uint32 length;
74437443
CHARSET_INFO *cs;
74447444

7445-
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
7445+
memcpy(&blob, ptr+packlength, sizeof(char*));
74467446
if (!blob)
74477447
return 0.0;
74487448
length= get_length(ptr);
@@ -7456,7 +7456,7 @@ longlong Field_blob::val_int(void)
74567456
ASSERT_COLUMN_MARKED_FOR_READ;
74577457
int not_used;
74587458
char *blob;
7459-
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
7459+
memcpy(&blob, ptr+packlength, sizeof(char*));
74607460
if (!blob)
74617461
return 0;
74627462
uint32 length=get_length(ptr);
@@ -7468,7 +7468,7 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
74687468
{
74697469
ASSERT_COLUMN_MARKED_FOR_READ;
74707470
char *blob;
7471-
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
7471+
memcpy(&blob, ptr+packlength, sizeof(char*));
74727472
if (!blob)
74737473
val_ptr->set("",0,charset()); // A bit safer than ->length(0)
74747474
else
@@ -7482,7 +7482,7 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
74827482
ASSERT_COLUMN_MARKED_FOR_READ;
74837483
const char *blob;
74847484
size_t length;
7485-
memcpy_fixed(&blob, ptr+packlength, sizeof(const uchar*));
7485+
memcpy(&blob, ptr+packlength, sizeof(const uchar*));
74867486
if (!blob)
74877487
{
74887488
blob= "";
@@ -7510,8 +7510,8 @@ int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
75107510
uint max_length)
75117511
{
75127512
uchar *blob1,*blob2;
7513-
memcpy_fixed(&blob1,a_ptr+packlength,sizeof(char*));
7514-
memcpy_fixed(&blob2,b_ptr+packlength,sizeof(char*));
7513+
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
7514+
memcpy(&blob2, b_ptr+packlength, sizeof(char*));
75157515
uint a_len= get_length(a_ptr), b_len= get_length(b_ptr);
75167516
set_if_smaller(a_len, max_length);
75177517
set_if_smaller(b_len, max_length);
@@ -7525,8 +7525,8 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
75257525
char *a,*b;
75267526
uint diff;
75277527
uint32 a_length,b_length;
7528-
memcpy_fixed(&a,a_ptr+packlength,sizeof(char*));
7529-
memcpy_fixed(&b,b_ptr+packlength,sizeof(char*));
7528+
memcpy(&a, a_ptr+packlength, sizeof(char*));
7529+
memcpy(&b, b_ptr+packlength, sizeof(char*));
75307530
a_length=get_length(a_ptr);
75317531
if (a_length > max_length)
75327532
a_length=max_length;
@@ -7607,7 +7607,7 @@ int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
76077607
{
76087608
uchar *blob1;
76097609
uint blob_length=get_length(ptr);
7610-
memcpy_fixed(&blob1,ptr+packlength,sizeof(char*));
7610+
memcpy(&blob1, ptr+packlength, sizeof(char*));
76117611
CHARSET_INFO *cs= charset();
76127612
uint local_char_length= max_key_length / cs->mbmaxlen;
76137613
local_char_length= my_charpos(cs, blob1, blob1+blob_length,
@@ -7685,7 +7685,7 @@ void Field_blob::sort_string(uchar *to,uint length)
76857685
break;
76867686
}
76877687
}
7688-
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
7688+
memcpy(&blob, ptr+packlength, sizeof(char*));
76897689

76907690
blob_length=my_strnxfrm(field_charset,
76917691
to, length, blob, blob_length);
@@ -8654,7 +8654,7 @@ String *Field_bit::val_str(String *val_buffer,
86548654
mi_int8store(buff,bits);
86558655

86568656
val_buffer->alloc(length);
8657-
memcpy_fixed((char*) val_buffer->ptr(), buff+8-length, length);
8657+
memcpy((char *) val_buffer->ptr(), buff+8-length, length);
86588658
val_buffer->length(length);
86598659
val_buffer->set_charset(&my_charset_bin);
86608660
return val_buffer;

sql/field.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,22 +1762,22 @@ class Field_blob :public Field_longstr {
17621762
void put_length(uchar *pos, uint32 length);
17631763
inline void get_ptr(uchar **str)
17641764
{
1765-
memcpy_fixed((uchar*) str,ptr+packlength,sizeof(uchar*));
1765+
memcpy(str, ptr+packlength, sizeof(uchar*));
17661766
}
17671767
inline void get_ptr(uchar **str, uint row_offset)
17681768
{
1769-
memcpy_fixed((uchar*) str,ptr+packlength+row_offset,sizeof(char*));
1769+
memcpy(str, ptr+packlength+row_offset, sizeof(char*));
17701770
}
17711771
inline void set_ptr(uchar *length, uchar *data)
17721772
{
17731773
memcpy(ptr,length,packlength);
1774-
memcpy_fixed(ptr+packlength,&data,sizeof(char*));
1774+
memcpy(ptr+packlength, &data,sizeof(char*));
17751775
}
17761776
void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length, uchar *data)
17771777
{
17781778
uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*);
17791779
store_length(ptr_ofs, packlength, length);
1780-
memcpy_fixed(ptr_ofs+packlength,&data,sizeof(char*));
1780+
memcpy(ptr_ofs+packlength, &data, sizeof(char*));
17811781
}
17821782
inline void set_ptr(uint32 length, uchar *data)
17831783
{
@@ -1796,7 +1796,7 @@ class Field_blob :public Field_longstr {
17961796
return 1;
17971797
}
17981798
tmp=(uchar*) value.ptr();
1799-
memcpy_fixed(ptr+packlength,&tmp,sizeof(char*));
1799+
memcpy(ptr+packlength, &tmp, sizeof(char*));
18001800
return 0;
18011801
}
18021802
virtual uchar *pack(uchar *to, const uchar *from,

sql/field_conv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static void do_copy_blob(Copy_field *copy)
286286
{
287287
ulong length=((Field_blob*) copy->from_field)->get_length();
288288
((Field_blob*) copy->to_field)->store_length(length);
289-
memcpy_fixed(copy->to_ptr,copy->from_ptr,sizeof(char*));
289+
memcpy(copy->to_ptr, copy->from_ptr, sizeof(char*));
290290
}
291291

292292
static void do_conv_blob(Copy_field *copy)

sql/filesort.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ void change_double_for_sort(double nr,uchar *to)
16651665
else
16661666
{
16671667
#ifdef WORDS_BIGENDIAN
1668-
memcpy_fixed(tmp,&nr,sizeof(nr));
1668+
memcpy(tmp, &nr, sizeof(nr));
16691669
#else
16701670
{
16711671
uchar *ptr= (uchar*) &nr;

sql/hostname.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void prepare_hostname_cache_key(const char *ip_string,
126126
DBUG_ASSERT(ip_string_length < HOST_ENTRY_KEY_SIZE);
127127

128128
memset(ip_key, 0, HOST_ENTRY_KEY_SIZE);
129-
memcpy_fixed(ip_key, ip_string, ip_string_length);
129+
memcpy(ip_key, ip_string, ip_string_length);
130130
}
131131

132132
static inline Host_entry *hostname_cache_search(const char *ip_key)
@@ -148,7 +148,7 @@ static bool add_hostname_impl(const char *ip_key, const char *hostname)
148148

149149
char *hostname_copy;
150150

151-
memcpy_fixed(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE);
151+
memcpy(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE);
152152

153153
if (hostname_size)
154154
{

sql/udf_example.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ typedef long long longlong;
133133
#include <string.h>
134134
#define strmov(a,b) stpcpy(a,b)
135135
#define bzero(a,b) memset(a,0,b)
136-
#define memcpy_fixed(a,b,c) memcpy(a,b,c)
137136
#endif
138137
#endif
139138
#include <mysql.h>
@@ -778,7 +777,7 @@ char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
778777
}
779778
pthread_mutex_unlock(&LOCK_hostname);
780779
#endif
781-
memcpy_fixed((char*) &in,(char*) *hostent->h_addr_list, sizeof(in.s_addr));
780+
memcpy(&in, *hostent->h_addr_list, sizeof(in.s_addr));
782781
*res_length= (ulong) (strmov(result, inet_ntoa(in)) - result);
783782
return result;
784783
}

0 commit comments

Comments
 (0)