]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
add new api to duplicate a string array
authorRay Strode <rstrode@redhat.com>
Fri, 18 May 2007 23:32:06 +0000 (19:32 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 18 May 2007 23:32:06 +0000 (19:32 -0400)
src/ply-utils.c
src/ply-utils.h

index 4605114ba27d7d31d06b3df960a0bced30486e67..fe8c18a6150267ec991cc62cb0ca7b348d533319 100644 (file)
@@ -84,8 +84,8 @@ ply_fd_has_data (int fd)
   result = poll (&poll_data, 1, 10);
 
   return result == 1 
-         && ((poll_data.revents & POLLIN) 
-         || (poll_data.revents & POLLPRI));
+         && ((poll_data.revents & POLLIN) 
+         || (poll_data.revents & POLLPRI));
 }
 
 bool 
@@ -101,3 +101,20 @@ ply_fd_can_take_data (int fd)
 
   return result == 1;
 }
+
+char **
+ply_copy_string_array (const char * const *array)
+{
+  char **copy;
+  int i;
+
+  for (i = 0; array[i] != NULL; i++);
+
+  copy = calloc (i + 1, char *);
+
+  for (i = 0; array[i] != NULL, i++)
+    copy[i] = strdup (array[i]);
+
+  return copy;
+}
+/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
index 32bf6186fe06a940470f3b7cc1ba68fa2a427db1..63e13732d48abbeb921b395241334088bec97e4c 100644 (file)
@@ -46,6 +46,7 @@ bool ply_write (int         fd,
                 size_t      number_of_bytes); 
 bool ply_fd_has_data (int fd);
 bool ply_fd_can_take_data (int fd);
+char **ply_copy_string_array (const char * const *array);
 #endif
 
 #endif /* PLY_UTILS_H */