1 | /* |
1 | /* |
2 | parse_simple.c - Part of psiconv, a PSION 5 file formats converter |
2 | parse_simple.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 1999-2004 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999-2014 Frodo Looijaard <frodo@frodo.looijaard.name> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
375 | /* Copy the list to the actual string */ |
375 | /* Copy the list to the actual string */ |
376 | if (!(result = malloc(sizeof(*result) * (psiconv_list_length(string) + 1)))) |
376 | if (!(result = malloc(sizeof(*result) * (psiconv_list_length(string) + 1)))) |
377 | goto ERROR2; |
377 | goto ERROR2; |
378 | for (i = 0; i < psiconv_list_length(string); i++) { |
378 | for (i = 0; i < psiconv_list_length(string); i++) { |
379 | if (!(nextcharptr = psiconv_list_get(string,i))) { |
379 | if (!(nextcharptr = psiconv_list_get(string,i))) { |
380 | psiconv_error(config,lev,off+i+len,"Internal data corruption"); |
380 | psiconv_error(config,lev,off+i+len,"Data structure corruption"); |
381 | goto ERROR3; |
381 | goto ERROR3; |
382 | } |
382 | } |
383 | result[i] = *nextcharptr; |
383 | result[i] = *nextcharptr; |
384 | } |
384 | } |
385 | result[i] = 0; |
385 | result[i] = 0; |