summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2007-05-18 19:32:06 -0400
committerRay Strode <rstrode@redhat.com>2007-05-18 19:32:06 -0400
commitbb52699a66f9498cc6f3e5146362d2ecfe12f356 (patch)
treee61bd9ad071073190abc4bac9405eb2b9b70e77a /src
parent816c885aa1db6652deeabee303914d17bde3aa15 (diff)
downloadplymouth-bb52699a66f9498cc6f3e5146362d2ecfe12f356.tar.gz
plymouth-bb52699a66f9498cc6f3e5146362d2ecfe12f356.tar.xz
plymouth-bb52699a66f9498cc6f3e5146362d2ecfe12f356.zip
add new api to duplicate a string array
Diffstat (limited to 'src')
-rw-r--r--src/ply-utils.c21
-rw-r--r--src/ply-utils.h1
2 files changed, 20 insertions, 2 deletions
diff --git a/src/ply-utils.c b/src/ply-utils.c
index 4605114..fe8c18a 100644
--- a/src/ply-utils.c
+++ b/src/ply-utils.c
@@ -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: */
diff --git a/src/ply-utils.h b/src/ply-utils.h
index 32bf618..63e1373 100644
--- a/src/ply-utils.h
+++ b/src/ply-utils.h
@@ -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 */