summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-09-23 17:06:44 +0300
committerunknown <monty@narttu.mysql.fi>2003-09-23 17:06:44 +0300
commit792aa09ee17b4ca88c92f297498237e46a4c7cf0 (patch)
tree3eac2fbc00ec3335470f74d59174520b731a9e75 /mysys
parent58ec8f35f7a92005b1a06f8d071b56649ca43857 (diff)
downloadmariadb-git-792aa09ee17b4ca88c92f297498237e46a4c7cf0.tar.gz
Code cleanup of new patches
mysys/mf_dirname.c: Added comments
Diffstat (limited to 'mysys')
-rw-r--r--mysys/default.c14
-rw-r--r--mysys/mf_dirname.c36
2 files changed, 35 insertions, 15 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 0318efeb448..3c9f9c823a1 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -375,9 +375,20 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
char *value_end;
for (value++ ; isspace(*value); value++) ;
value_end=strend(value);
+ /*
+ We don't have to test for value_end >= value as we know there is
+ an '=' before
+ */
for ( ; isspace(value_end[-1]) ; value_end--) ;
if (value_end < value) /* Empty string */
value_end=value;
+
+ /* remove quotes around argument */
+ if ((*value == '\"' || *value == '\'') && *value == value_end[-1])
+ {
+ value++;
+ value_end--;
+ }
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 +
(uint) (value_end-value)+1)))
goto err;
@@ -385,10 +396,9 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
goto err;
ptr=strnmov(strmov(tmp,"--"),ptr,(uint) (end-ptr));
*ptr++= '=';
+
for ( ; value != value_end; value++)
{
- if (*value == '\"' || *value == '\'')
- continue;
if (*value == '\\' && value != value_end-1)
{
switch(*++value) {
diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c
index 6523abcdb12..d35f2c4f7ae 100644
--- a/mysys/mf_dirname.c
+++ b/mysys/mf_dirname.c
@@ -54,19 +54,29 @@ uint dirname_part(my_string to, const char *name)
} /* dirname */
- /*
- Convert directory name to use under this system
- If MSDOS converts '/' to '\'
- If VMS converts '<' to '[' and '>' to ']'
- Adds a FN_LIBCHAR to end if the result string if there isn't one
- and the last isn't dev_char.
- Copies data from 'from' until ASCII(0) for until from == from_end
- If you want to use the whole 'from' string, just send NullS as the
- last argument.
- If the result string is larger than FN_REFLEN -1, then it's cut.
-
- Returns pointer to end \0
- */
+/*
+ Convert directory name to use under this system
+
+ SYNPOSIS
+ convert_dirname()
+ to Store result here
+ from Original filename
+ from_end Pointer at end of filename (normally end \0)
+
+ IMPLEMENTATION
+ If MSDOS converts '/' to '\'
+ If VMS converts '<' to '[' and '>' to ']'
+ Adds a FN_LIBCHAR to end if the result string if there isn't one
+ and the last isn't dev_char.
+ Copies data from 'from' until ASCII(0) for until from == from_end
+ If you want to use the whole 'from' string, just send NullS as the
+ last argument.
+
+ If the result string is larger than FN_REFLEN -1, then it's cut.
+
+ RETURN
+ Returns pointer to end \0 in to
+*/
#ifndef FN_DEVCHAR
#define FN_DEVCHAR '\0' /* For easier code */