| 1036 | */ |
| 1037 | |
| 1038 | static struct languages *parse_charset_string(char *str) |
| 1039 | { |
| 1040 | struct languages *head=0, *new_lang; |
| 1041 | DBUG_ENTER("parse_charset_string"); |
| 1042 | DBUG_PRINT("enter", ("str: %s", str)); |
| 1043 | |
| 1044 | /* skip over keyword */ |
| 1045 | str= find_end_of_word(str); |
| 1046 | if (!*str) |
| 1047 | { |
| 1048 | /* unexpected EOL */ |
| 1049 | DBUG_PRINT("info", ("str: %s", str)); |
| 1050 | DBUG_RETURN(0); |
| 1051 | } |
| 1052 | |
| 1053 | str= skip_delimiters(str); |
| 1054 | if (!(*str != ';' && *str)) |
| 1055 | DBUG_RETURN(0); |
| 1056 | |
| 1057 | do |
| 1058 | { |
| 1059 | /*creating new element of the linked list */ |
| 1060 | new_lang= (struct languages *) my_malloc(sizeof(*new_lang), MYF(MY_WME)); |
| 1061 | new_lang->next_lang= head; |
| 1062 | head= new_lang; |
| 1063 | |
| 1064 | /* get the full language name */ |
| 1065 | |
| 1066 | if (!(new_lang->lang_long_name= get_word(&str))) |
| 1067 | DBUG_RETURN(0); /* OOM: Fatal error */ |
| 1068 | |
| 1069 | DBUG_PRINT("info", ("long_name: %s", new_lang->lang_long_name)); |
| 1070 | |
| 1071 | /* getting the short name for language */ |
| 1072 | str= skip_delimiters(str); |
| 1073 | if (!*str) |
| 1074 | DBUG_RETURN(0); /* Error: No space or tab */ |
| 1075 | |
| 1076 | if (!(new_lang->lang_short_name= get_word(&str))) |
| 1077 | DBUG_RETURN(0); /* OOM: Fatal error */ |
| 1078 | DBUG_PRINT("info", ("short_name: %s", new_lang->lang_short_name)); |
| 1079 | |
| 1080 | /* getting the charset name */ |
| 1081 | str= skip_delimiters(str); |
| 1082 | if (!(new_lang->charset= get_word(&str))) |
| 1083 | DBUG_RETURN(0); /* Fatal error */ |
| 1084 | DBUG_PRINT("info", ("charset: %s", new_lang->charset)); |
| 1085 | |
| 1086 | /* skipping space, tab or "," */ |
| 1087 | str= skip_delimiters(str); |
| 1088 | } |
| 1089 | while (*str != ';' && *str); |
| 1090 | |
| 1091 | DBUG_PRINT("info", ("long name: %s", new_lang->lang_long_name)); |
| 1092 | DBUG_RETURN(head); |
| 1093 | } |
| 1094 | |
| 1095 |
no test coverage detected