diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_malloc.c | 12 | ||||
-rw-r--r-- | mysys/safemalloc.c | 14 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index 1e7cdd3a3b5..fc2f22b079a 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -81,3 +81,15 @@ my_string my_strdup(const char *from, myf MyFlags) memcpy((byte*) ptr, (byte*) from,(size_t) length); return((my_string) ptr); } + + +gptr my_strdup_with_length(const byte *from, uint length, myf MyFlags) +{ + gptr ptr; + if ((ptr=my_malloc(length+1,MyFlags)) != 0) + { + memcpy((byte*) ptr, (byte*) from,(size_t) length); + ptr[length]=0; + } + return(ptr); +} diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 9615126f237..f7e77878e41 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -538,3 +538,17 @@ my_string _my_strdup(const char *from, const char *sFile, uint uLine, memcpy((byte*) ptr, (byte*) from,(size_t) length); return((my_string) ptr); } /* _my_strdup */ + + +my_string _my_strdup_with_length(const char *from, uint length, + const char *sFile, uint uLine, + myf MyFlags) +{ + gptr ptr; + if ((ptr=_mymalloc(length+1,sFile,uLine,MyFlags)) != 0) + { + memcpy((byte*) ptr, (byte*) from,(size_t) length); + ptr[length]=0; + } + return((my_string) ptr); +} diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 11e6fa97ab6..7d72a4d45ae 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -655,6 +655,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) { + (*alrm)= &alarm->alarmed; if (alarm_aborted) { alarm->alarmed.crono=0; @@ -663,7 +664,6 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000, (TIMERPROC) NULL))) return 1; - (*alrm)= &alarm->alarmed; return 0; } |