summaryrefslogtreecommitdiff
path: root/sql/strfunc.cc
diff options
context:
space:
mode:
authorserg@sergbook.mysql.com <>2004-12-31 15:26:24 +0100
committerserg@sergbook.mysql.com <>2004-12-31 15:26:24 +0100
commita04fc26c5429284ddae3b5aa19220b057d84b302 (patch)
tree928b06c231edee4cb95ace87ed30e879e3dcb0fb /sql/strfunc.cc
parent849d1203ffb0a68ccec2e9e6e1baba00b2fbe536 (diff)
parent45ce994e5dc31c6eb802c3b8eb8955c320a4c111 (diff)
downloadmariadb-git-a04fc26c5429284ddae3b5aa19220b057d84b302.tar.gz
manually merged
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r--sql/strfunc.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 777b3851294..824aa15097e 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -170,6 +170,43 @@ uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
/*
+ Un-hex all elements in a typelib
+
+ SYNOPSIS
+ unhex_type2()
+ interval TYPELIB (struct of pointer to values + lengths + count)
+
+ NOTES
+
+ RETURN
+ N/A
+*/
+
+void unhex_type2(TYPELIB *interval)
+{
+ for (uint pos= 0; pos < interval->count; pos++)
+ {
+ char *from, *to;
+ for (from= to= (char*) interval->type_names[pos]; *from; )
+ {
+ /*
+ Note, hexchar_to_int(*from++) doesn't work
+ one some compilers, e.g. IRIX. Looks like a compiler
+ bug in inline functions in combination with arguments
+ that have a side effect. So, let's use from[0] and from[1]
+ and increment 'from' by two later.
+ */
+
+ *to++= (char) (hexchar_to_int(from[0]) << 4) +
+ hexchar_to_int(from[1]);
+ from+= 2;
+ }
+ interval->type_lengths[pos] /= 2;
+ }
+}
+
+
+/*
Check if the first word in a string is one of the ones in TYPELIB
SYNOPSIS