1032
1032
return attribute;
1036
1036
* MapArrayTypeName
1037
* XXX arrays of "basetype" are always "_basetype".
1038
* this is an evil hack inherited from rel. 3.1.
1039
* XXX array dimension is thrown away because we
1040
* don't support fixed-dimension arrays. again,
1041
* sickness from 3.1.
1043
* the string passed in must have a '[' character in it
1045
* the string returned is a pointer to static storage and should NOT
1046
* be freed by the CALLER.
1038
* Given a type name, produce the corresponding array type name by prepending
1039
* '_' and truncating as needed to fit in NAMEDATALEN-1 bytes. This is only
1040
* used in bootstrap mode, so we can get away with assuming that the input is
1041
* ASCII and we don't need multibyte-aware truncation.
1043
* The given string normally ends with '[]' or '[digits]'; we discard that.
1045
* The result is a palloc'd string.
1050
MapArrayTypeName(char *s)
1048
MapArrayTypeName(const char *s)
1054
static char newStr[NAMEDATALEN]; /* array type names < NAMEDATALEN long */
1056
if (s == NULL || s[0] == '\0')
1052
char newStr[NAMEDATALEN];
1061
for (i = 0; i < NAMEDATALEN - 1 && s[i] != '['; i++, j++)
1056
for (i = 0; i < NAMEDATALEN - 2 && s[i] != '['; i++, j++)
1062
1057
newStr[j] = s[i];
1064
1059
newStr[j] = '\0';
1061
return pstrdup(newStr);