| 224 | } |
| 225 | |
| 226 | struct mapfragment * |
| 227 | mapfrag_fromstr(char *str) |
| 228 | { |
| 229 | struct mapfragment *mf = (struct mapfragment *) alloc(sizeof *mf); |
| 230 | |
| 231 | char *tmps; |
| 232 | |
| 233 | mf->data = dupstr(str); |
| 234 | |
| 235 | (void) stripdigits(mf->data); |
| 236 | mf->wid = str_lines_maxlen(mf->data); |
| 237 | mf->hei = 0; |
| 238 | tmps = mf->data; |
| 239 | while (tmps && *tmps) { |
| 240 | char *s1 = strchr(tmps, '\n'); |
| 241 | |
| 242 | if (mf->hei > MAP_Y_LIM) { |
| 243 | free(mf->data); |
| 244 | free(mf); |
| 245 | return NULL; |
| 246 | } |
| 247 | if (s1) |
| 248 | s1++; |
| 249 | tmps = s1; |
| 250 | mf->hei++; |
| 251 | } |
| 252 | return mf; |
| 253 | } |
| 254 | |
| 255 | void |
| 256 | mapfrag_free(struct mapfragment **mf) |
no test coverage detected