X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Futils_array.h;h=252c8a76bb6a1cafd469184a49c32ac3091bfa3b;hp=141dbaa48fdd2ca432cb5ee0459c05c09e61a0c5;hb=d00ed057f5ca87431c18ecbf9c45364eb85c24f4;hpb=18acc4106233bdc59011a0a87d2f4a3373d65c9b diff --git a/src/utils_array.h b/src/utils_array.h index 141dbaa..252c8a7 100644 --- a/src/utils_array.h +++ b/src/utils_array.h @@ -1,3 +1,26 @@ +/** + * collection4 - utils_array.h + * Copyright (C) 2010 Florian octo Forster + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * Authors: + * Florian octo Forster + **/ + #ifndef UTILS_ARRAY_H #define UTILS_ARRAY_H 1 @@ -6,10 +29,19 @@ typedef struct str_array_s str_array_t; str_array_t *array_create (void); void array_destroy (str_array_t *a); + +/* Appends a string to the array. The string is duplicated, so the original + * string may / must be freed. */ int array_append (str_array_t *a, const char *entry); int array_append_format (str_array_t *a, const char *format, ...) __attribute__((format(printf,2,3))); +/* Prepends a string to the array. The string is duplicated, so the original + * string may / must be freed. */ +int array_prepend (str_array_t *a, const char *entry); +int array_prepend_format (str_array_t *a, const char *format, ...) + __attribute__((format(printf,2,3))); + int array_sort (str_array_t *a); int array_argc (str_array_t *);