-
Jon Olav Hauglid authored
The MySQL implementation of strmov() supports overlapping source and destination. This makes sense given the name as it is similar to the C API function memmove(). However, on platforms which support the POSIX function stpcpy(), we did "#define strmov(A,B) stpcpy((A),(B))". This is a problem as stpcpy() does not support overlapping source and destination. Therefore strmov() could have different behavior from platform to platform. Another (smaller) issue, was that strmov() sounds like it returns a pointer to the destination (like strcpy()) and not, as in fact does, a pointer to the terminating NULL (as stpcpy()). This patch does the following: 1) Renames strmov() to my_stpmov() and strnmov() to my_stpnmov(). 2) Adds my_stpcpy() which is stpcpy() if supported, my_stpmov() otherwise. 3) Adds my_stpncpy() which is stpncpy() if supported, my_stpnmov() otherwise. 4) Replaces existing calls to strmov() with my_stpcpy(). 5) Replaces existing calls to strnmov() with my_stpncpy() or my_stpnmov(). 5) Removes strmov_overlapp() and replaces its usage by my_stpmov().
Jon Olav Hauglid authoredThe MySQL implementation of strmov() supports overlapping source and destination. This makes sense given the name as it is similar to the C API function memmove(). However, on platforms which support the POSIX function stpcpy(), we did "#define strmov(A,B) stpcpy((A),(B))". This is a problem as stpcpy() does not support overlapping source and destination. Therefore strmov() could have different behavior from platform to platform. Another (smaller) issue, was that strmov() sounds like it returns a pointer to the destination (like strcpy()) and not, as in fact does, a pointer to the terminating NULL (as stpcpy()). This patch does the following: 1) Renames strmov() to my_stpmov() and strnmov() to my_stpnmov(). 2) Adds my_stpcpy() which is stpcpy() if supported, my_stpmov() otherwise. 3) Adds my_stpncpy() which is stpncpy() if supported, my_stpnmov() otherwise. 4) Replaces existing calls to strmov() with my_stpcpy(). 5) Replaces existing calls to strnmov() with my_stpncpy() or my_stpnmov(). 5) Removes strmov_overlapp() and replaces its usage by my_stpmov().
Loading