//-----------------------------------------------------------------
/**
* ul_dbuff_strcat - appends str at dhe end of buffer and change its capacity if neccessary
+ * @buf: buffer structure
* @str: string to append
*
* Returns number length of buffer (including terminating '\0')
//-----------------------------------------------------------------
/**
* ul_dbuff_strcpy - copy str to the buffer and change its capacity if neccessary
+ * @buf: buffer structure
* @str: string to copy
*
* Returns number length of buffer (including terminating '\0')
//-----------------------------------------------------------------
/**
-* ul_dbuff_append_byte - appends byte at dhe end of buffer and change its capacity if neccessary
-* @buf: buffer structure
-* @b: appended byte
-*
+ * ul_dbuff_append_byte - appends byte at dhe end of buffer and change its capacity if neccessary
+ * @buf: buffer structure
+ * @b: appended byte
+ *
* Returns number length of buffer (including terminating '\0')
-*/
+ */
inline int ul_dbuff_append_byte(ul_dbuff_t *buf, unsigned char b)
{
return ul_dbuff_cat(buf, &b, 1);
//-----------------------------------------------------------------
/**
* ul_dbuff_rtrim - remove all white space characters from the right
- * if buffer is terminated by '\0', than is also terminated after rtrim
* @buf: buffer structure
*
+ * if buffer is terminated by '\0', than is also terminated after rtrim
+ *
* Return: new length of buffer
*/
int ul_dbuff_rtrim(ul_dbuff_t *buf)
}
//-----------------------------------------------------------------
/**
- * ul_str_ncpy - copyes string to the buffer<br>
- * Standard strncpy function have some disadvatages
- * (ie. do not append term. zero if copied string doesn't fit in to buffer, fills whole rest of buffer with zeros)
+ * ul_str_ncpy - copies string to the buffer
* @to: buffer where to copy str
* @from: zero terminated string
- * @buff_size: size of the <code>to</code> buffer (including terminating zero)
+ * @buff_size: size of the @to buffer (including terminating zero)
+ *
+ * Standard strncpy function have some disadvatages
+ * (ie. do not append term. zero if copied string doesn't fit in to buffer, fills whole rest of buffer with zeros)
*
* Returns strlen(to) or negative value in case of error
*/
* @fromdb: buffer to cut from
* @todb: buffer to copy to
* @delimiter: delimiter char
- * quote: quoted delimiters are ignored, @quote can be '\0', than it is ignored.
+ * @quote: quoted delimiters are ignored, @quote can be '\0', than it is ignored.
*/
void ul_dbuff_cut_delimited(ul_dbuff_t *fromdb, ul_dbuff_t *todb, char delimiter, char quote)
{
#define GSA_ALLOC_STEP 8
#define GSA_DEALLOC_STEP 32
+/**
+ * gsa_struct_init - Initialize GSA Structure
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key_offs: offset to the order controlling field obtained by %UL_OFFSETOF
+ * @cmp_fnc: function defining order of items by comparing fields at offset
+ * @key_offs.
+ */
void
gsa_struct_init(gsa_array_t *array, int key_offs,
gsa_cmp_fnc_t *cmp_fnc)
array->items=NULL;
};
+/**
+ * gsa_delete_all - Delete Pointers to the All Items in the Array
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ *
+ * This function releases all internally allocated memory,
+ * but does not release memory of the @array structure
+ */
void
gsa_delete_all(gsa_array_t *array)
{
}
+/**
+ * gsa_bsearch_indx - Search for Item or Place for Item by Key
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key: key value searched for
+ * @key_offs: offset to the order controlling field obtained by %UL_OFFSETOF
+ * @cmp_fnc: function defining order of items by comparing fields
+ * @mode: mode of the search operation
+ * @indx: pointer to place, where store value of found item array index
+ * or index where new item should be inserted
+ *
+ * Core search routine for GSA arrays
+ * binary searches for item with field at offset @key_off equal to @key value
+ * Values are compared by function pointed by *@cmp_fnc field in the array
+ * structure @array.
+ * Integer @mode modifies search algorithm:
+ * %GSA_FANY .. finds item with field value *@key,
+ * %GSA_FFIRST .. finds the first item with field value *@key,
+ * %GSA_FAFTER .. index points after last item with *@key value,
+ * reworded - index points at first item with higher
+ * value of field or after last item
+ * Return Value: Return of nonzero value indicates match found.
+ */
int
gsa_bsearch_indx(gsa_array_t *array, void *key, int key_offs,
gsa_cmp_fnc_t *cmp_fnc, int mode, unsigned *indx)
return 1;
}
+/**
+ * gsa_find - Find Item for Provided Key
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key: key value searched for
+ *
+ * Return Value: pointer to item associated to key value or %NULL.
+ */
void *
gsa_find(gsa_array_t *array, void *key)
{
else return NULL;
}
+/**
+ * gsa_find_first - Find the First Item for Provided Key
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key: key value searched for
+ *
+ * same as above, but first matching item is found.
+ * Return Value: pointer to the first item associated to key value or %NULL.
+ */
void *
gsa_find_first(gsa_array_t *array, void *key)
{
else return NULL;
}
+/**
+ * gsa_find_indx - Find the First Item with Key Value and Return Its Index
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key: key value searched for
+ * @indx: pointer to place for index, at which new item should be inserted
+ *
+ * same as above, but additionally stores item index value.
+ * Return Value: pointer to the first item associated to key value or %NULL.
+ */
void *
gsa_find_indx(gsa_array_t *array, void *key, int *indx)
{
else return NULL;
}
+/**
+ * gsa_insert_at - Insert Existing Item to the Specified Array Index
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @item: pointer to inserted Item
+ * @where: at which index should be @item inserted
+ *
+ * Return Value: positive or zero value informs about success
+ */
int
gsa_insert_at(gsa_array_t *array, void *item, unsigned where)
{
return 0;
}
+/**
+ * gsa_insert - Insert Existing into Ordered Item Array
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @item: pointer to inserted Item
+ * @mode: if mode is %GSA_FAFTER, multiple items with same key can
+ * be stored into array, else strict ordering is required
+ *
+ * Return Value: positive or zero value informs about success
+ */
int
gsa_insert(gsa_array_t *array, void *item, int mode)
{
return res;
}
+/**
+ * gsa_delete_at - Delete Item from the Specified Array Index
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @indx: index of deleted item
+ *
+ * Return Value: positive or zero value informs about success
+ */
int
gsa_delete_at(gsa_array_t *array, unsigned indx)
{
return 0;
}
+/**
+ * gsa_delete - Delete Item from the Array
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @item: pointer to deleted Item
+ *
+ * Return Value: positive or zero value informs about success
+ */
int
gsa_delete(gsa_array_t *array, void *item)
{
return gsa_delete_at(array,indx);
}
+/**
+ * gsa_resort_buble - Sort Again Array If Sorting Criteria Are Changed
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key_offs: offset to the order controlling field obtained by %UL_OFFSETOF
+ * @cmp_fnc: function defining order of items by comparing fields
+ *
+ * Return Value: non-zero value informs, that resorting changed order
+ */
int
gsa_resort_buble(gsa_array_t *array, int key_offs,
gsa_cmp_fnc_t *cmp_fnc)
}while(1);
}
+/**
+ * gsa_setsort - Change Array Sorting Criterion
+ * @array: pointer to the array structure declared through %GSA_ARRAY_FOR
+ * @key_offs: new value of offset to the order controlling field
+ * @cmp_fnc: new function defining order of items by comparing fields at
+ * offset @key_offs
+ *
+ * Return Value: non-zero value informs, that resorting changed order
+ */
int
gsa_setsort(gsa_array_t *array, int key_offs,
gsa_cmp_fnc_t *cmp_fnc)