| 145 | } |
| 146 | |
| 147 | int |
| 148 | add_custom_urep_entry( |
| 149 | const char *customization_name, |
| 150 | int glyphidx, |
| 151 | uint32 utf32ch, |
| 152 | const uint8 *utf8str, |
| 153 | enum graphics_sets which_set) |
| 154 | { |
| 155 | struct symset_customization *gdc |
| 156 | = &gs.sym_customizations[which_set][custom_ureps]; |
| 157 | struct customization_detail *details, *newdetails = 0; |
| 158 | |
| 159 | |
| 160 | if (!gdc->details) { |
| 161 | gdc->customization_name = dupstr(customization_name); |
| 162 | gdc->custtype = custom_ureps; |
| 163 | gdc->details = 0; |
| 164 | gdc->details_end = 0; |
| 165 | } |
| 166 | details = find_matching_customization(customization_name, |
| 167 | custom_ureps, which_set); /* FIXME */ |
| 168 | if (details) { |
| 169 | while (details) { |
| 170 | if (details->content.urep.glyphidx == glyphidx) { |
| 171 | if (details->content.urep.u.utf8str) |
| 172 | free(details->content.urep.u.utf8str); |
| 173 | if (utf32ch) { |
| 174 | details->content.urep.u.utf8str = |
| 175 | (uint8 *) dupstr((const char *) utf8str); |
| 176 | details->content.urep.u.utf32ch = utf32ch; |
| 177 | } else { |
| 178 | details->content.urep.u.utf8str = (uint8 *) 0; |
| 179 | details->content.urep.u.utf32ch = 0; |
| 180 | } |
| 181 | return 1; |
| 182 | } |
| 183 | details = details->next; |
| 184 | } |
| 185 | } |
| 186 | /* create new details entry */ |
| 187 | newdetails = (struct customization_detail *) alloc( |
| 188 | sizeof (struct customization_detail)); |
| 189 | newdetails->content.urep.glyphidx = glyphidx; |
| 190 | if (utf8str && *utf8str) { |
| 191 | newdetails->content.urep.u.utf8str = |
| 192 | (uint8 *) dupstr((const char *) utf8str); |
| 193 | } else { |
| 194 | newdetails->content.urep.u.utf8str = |
| 195 | (uint8 *) 0; |
| 196 | } |
| 197 | newdetails->content.urep.u.utf32ch = utf32ch; |
| 198 | newdetails->next = (struct customization_detail *) 0; |
| 199 | if (gdc->details == NULL) { |
| 200 | gdc->details = newdetails; |
| 201 | } else { |
| 202 | gdc->details_end->next = newdetails; |
| 203 | } |
| 204 | gdc->details_end = newdetails; |
no test coverage detected