added function to count strings in array
[rocksndiamonds.git] / src / libgame / misc.c
index 2ef55766ca53113ddd5d1672f2100acef029907b..2c3e449361dd0c1f2ce21becf7bb643caede8548 100644 (file)
@@ -1295,6 +1295,19 @@ char **getSplitStringArray(const char *s, const char *separators, int max_tokens
   return tokens;
 }
 
+int getStringArrayLength(char **s_array)
+{
+  int num_strings = 0;
+
+  if (s_array == NULL)
+    return 0;
+
+  while (s_array[num_strings] != NULL)
+    num_strings++;
+
+  return num_strings;
+}
+
 void freeStringArray(char **s_array)
 {
   int i;