1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
455 | size_t size; |
455 | size_t size; |
456 | size_t i; |
456 | size_t i; |
457 | |
457 | |
458 | dup = strdup (str); |
458 | dup = strdup (str); |
459 | if (dup == NULL) |
459 | if (dup == NULL) |
460 | fatal (OUT_OF_MEMORY); |
460 | fatal ("out of memory"); |
461 | |
461 | |
462 | size = 0; |
462 | size = 0; |
463 | for (p = strtok (dup, ","); p != NULL; p = strtok (NULL, ",")) |
463 | for (p = strtok (dup, ","); p != NULL; p = strtok (NULL, ",")) |
464 | size++; |
464 | size++; |
465 | |
465 | |
466 | *result_list = (char **) malloc (size * sizeof (*result_list)); |
466 | *result_list = (char **)malloc (size * sizeof (*result_list)); |
467 | |
467 | |
468 | *result_size = size; |
468 | *result_size = size; |
469 | |
469 | |
470 | for (i = 0; i < size; i++) |
470 | for (i = 0; i < size; i++) |
471 | { |
471 | { |