diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-06-01 15:51:25 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-06-01 15:51:25 +0200 |
commit | 5091a4ba755250ed8e35f4f5a39a118d476cd8f1 (patch) | |
tree | 370ba468d78204544b56e9d967d8d09e1317a1ed /storage/connect/plugutil.c | |
parent | 84eaf0911f311acba797c265ef7508ab6c108b35 (diff) | |
parent | 0880284bf715b4916cc735e19b76d1062c2bfdcf (diff) | |
download | mariadb-git-5091a4ba755250ed8e35f4f5a39a118d476cd8f1.tar.gz |
Merge tag 'mariadb-10.0.19' into 10.1
Diffstat (limited to 'storage/connect/plugutil.c')
-rw-r--r-- | storage/connect/plugutil.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c index 18b48b8eccc..36d115e0096 100644 --- a/storage/connect/plugutil.c +++ b/storage/connect/plugutil.c @@ -6,7 +6,7 @@ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 1993-2014 */ +/* (C) Copyright to the author Olivier BERTRAND 1993-2015 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -228,7 +228,6 @@ BOOL PlugIsAbsolutePath(LPCSTR path) #endif } - /***********************************************************************/ /* Set the full path of a file relatively to a given path. */ /* Note: this routine is not really implemented for Unix. */ @@ -385,8 +384,7 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) err: if (g) { // Called by STEP - msg = (char *)PlugSubAlloc(g, NULL, strlen(stmsg) + 1); - strcpy(msg, stmsg); + msg = PlugDup(g, stmsg); } else // Called by MSG or PlgGetErrorMsg msg = stmsg; @@ -421,8 +419,7 @@ char *PlugGetMessage(PGLOBAL g, int mid) if (g) { // Called by STEP - msg = (char *)PlugSubAlloc(g, NULL, strlen(stmsg) + 1); - strcpy(msg, stmsg); + msg = PlugDup(g, stmsg); } else // Called by MSG or PlgGetErrorMsg msg = stmsg; @@ -537,6 +534,22 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) } /* end of PlugSubAlloc */ /***********************************************************************/ +/* Program for sub-allocating and copying a string in a storage area. */ +/***********************************************************************/ +char *PlugDup(PGLOBAL g, const char *str) + { + if (str) { + char *sm = (char*)PlugSubAlloc(g, NULL, strlen(str) + 1); + + strcpy(sm, str); + return sm; + } else + return NULL; + + } // end of PlugDup + +#if 0 +/***********************************************************************/ /* This routine suballocate a copy of the passed string. */ /***********************************************************************/ char *PlugDup(PGLOBAL g, const char *str) @@ -552,6 +565,7 @@ char *PlugDup(PGLOBAL g, const char *str) return(buf); } /* end of PlugDup */ +#endif // 0 /***********************************************************************/ /* This routine makes a pointer from an offset to a memory pointer. */ |