[ekg2-commit] r3836 - trunk/ekg: trunk/ekg/dynstuff.c trunk/ekg/dynstuff.h trunk/ekg/themes.h

SVN commit svn w toxygen.net
Pon, 3 Mar 2008, 14:36:16 CET


Author: peres
Date: 2008-03-03 14:36:16 +0100 (Mon, 03 Mar 2008)
New Revision: 3836

Modified:
   trunk/ekg/dynstuff.c
   trunk/ekg/dynstuff.h
   trunk/ekg/themes.h
Log:

Ok, that amount of size_t was just stupid. Leaving it only on x-libc things,
where original ones use them (xwcslen, for example).



Modified: trunk/ekg/dynstuff.c
===================================================================
--- trunk/ekg/dynstuff.c	2008-03-03 12:32:49 UTC (rev 3835)
+++ trunk/ekg/dynstuff.c	2008-03-03 13:36:16 UTC (rev 3836)
@@ -40,7 +40,7 @@
  *
  * zwraca wskaźnik zaalokowanego elementu lub NULL w przpadku błędu.
  */
-void *list_add_sorted(list_t *list, void *data, size_t alloc_size, int (*comparision)(void *, void *))
+void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparision)(void *, void *))
 {
 	list_t new, tmp;
 
@@ -100,7 +100,7 @@
  * @sa list_remove()
  */
 
-void *list_add_beginning(list_t *list, void *data, size_t alloc_size) {
+void *list_add_beginning(list_t *list, void *data, int alloc_size) {
 
 	list_t new;
 
@@ -134,7 +134,7 @@
  * @sa list_add_sorted()
  */
 
-void *list_add(list_t *list, void *data, size_t alloc_size)
+void *list_add(list_t *list, void *data, int alloc_size)
 {
 	return list_add_sorted(list, data, alloc_size, NULL);
 }
@@ -266,7 +266,7 @@
  * @return n'th item (list->data) if found, or NULL with errno set to ENOENT
  */
 
-void *list_get_nth(list_t list, off_t id) {
+void *list_get_nth(list_t list, int id) {
 	while (list) {
 		if ((--id) == 0) {
 			/* errno = !ENOENT; */
@@ -364,7 +364,7 @@
  *  - s - ciąg znaków,
  *  - count - wymagana ilość znaków (bez końcowego '\0').
  */
-static void string_realloc(string_t s, size_t count)
+static void string_realloc(string_t s, int count)
 {
 	char *tmp;
 	
@@ -423,7 +423,7 @@
  *		-1 and errno set to EFAULT if input params were wrong (s == NULL || str == NULL)
  */
 
-int string_append_n(string_t s, const char *str, size_t count)
+int string_append_n(string_t s, const char *str, int count)
 {
 	if (!s || !str) {
 		errno = EFAULT;
@@ -493,7 +493,7 @@
  * @todo XXX Protect from negative count (and less than -1) ?
  */
 
-int string_append_raw(string_t s, const char *str, size_t count) {
+int string_append_raw(string_t s, const char *str, int count) {
 	if (!s || !str) {
 		errno = EFAULT;
 		return -1;
@@ -535,7 +535,7 @@
  *  - str - tekst do dopisania,
  *  - count - ilość znaków do dopisania (-1 znaczy, że wszystkie).
  */
-void string_insert_n(string_t s, off_t index, const char *str, size_t count)
+void string_insert_n(string_t s, int index, const char *str, int count)
 {
 	if (!s || !str)
 		return;
@@ -567,7 +567,7 @@
  * @sa string_insert_n()
  */
 
-void string_insert(string_t s, off_t index, const char *str)
+void string_insert(string_t s, int index, const char *str)
 {
 	string_insert_n(s, index, str, -1);
 }
@@ -605,7 +605,7 @@
  *
  */
 
-void string_remove(string_t s, size_t count) {
+void string_remove(string_t s, int count) {
 	if (!s || count <= 0)
 		return;
 	
@@ -717,7 +717,7 @@
  * zaalokowaną tablicę z zaalokowanymi ciągami znaków, którą należy
  * zwolnić funkcją array_free()
  */
-char **array_make(const char *string, const char *sep, size_t max, int trim, int quotes)
+char **array_make(const char *string, const char *sep, int max, int trim, int quotes)
 {
 	const char *p, *q;
 	char **result = NULL;
@@ -894,7 +894,7 @@
 	return string_free(s, 0);
 }
 
-char *array_join_count(char **array, const char *sep, size_t count) {
+char *array_join_count(char **array, const char *sep, int count) {
 	string_t s = string_init(NULL);
 
 	if (array) {
@@ -986,7 +986,7 @@
 	xfree(array);
 }
 
-void array_free_count(char **array, size_t count) {
+void array_free_count(char **array, int count) {
 	char **tmp;
 
 	if (!array)

Modified: trunk/ekg/dynstuff.h
===================================================================
--- trunk/ekg/dynstuff.h	2008-03-03 12:32:49 UTC (rev 3835)
+++ trunk/ekg/dynstuff.h	2008-03-03 13:36:16 UTC (rev 3836)
@@ -21,9 +21,6 @@
 #ifndef __EKG_DYNSTUFF_H
 #define __EKG_DYNSTUFF_H
 
-#include <stdlib.h> /* size_t */
-#include <sys/types.h> /* off_t */
-
 /*
  * typedef list_t
  *
@@ -64,12 +61,12 @@
 
 #define LIST_DESTROY(list, func)			list_destroy2(list, (void *) func)
 
-void *list_add(list_t *list, void *data, size_t alloc_size);
-void *list_add_beginning(list_t *list, void *data, size_t alloc_size);
-void *list_add_sorted(list_t *list, void *data, size_t alloc_size, int (*comparision)(void *, void *));
+void *list_add(list_t *list, void *data, int alloc_size);
+void *list_add_beginning(list_t *list, void *data, int alloc_size);
+void *list_add_sorted(list_t *list, void *data, int alloc_size, int (*comparision)(void *, void *));
 
 int list_count(list_t list);
-void *list_get_nth(list_t list, off_t id);
+void *list_get_nth(list_t list, int id);
 void list_resort(list_t *list, int (*comparision)(void *, void *));
 
 int list_remove(list_t *list, void *data, int free_data);
@@ -101,7 +98,7 @@
 
 struct string {
 	char *str;
-	size_t len, size;
+	int len, size;
 };
 
 typedef struct string *string_t;
@@ -110,20 +107,20 @@
 
 string_t string_init(const char *str);
 int string_append(string_t s, const char *str);
-int string_append_n(string_t s, const char *str, size_t count);
+int string_append_n(string_t s, const char *str, int count);
 int string_append_c(string_t s, char ch);
-int string_append_raw(string_t s, const char *str, size_t count);
+int string_append_raw(string_t s, const char *str, int count);
 int string_append_format(string_t s, const char *format, ...);
-void string_insert(string_t s, off_t index, const char *str);
-void string_insert_n(string_t s, off_t index, const char *str, size_t count);
-void string_remove(string_t s, size_t count);
+void string_insert(string_t s, int index, const char *str);
+void string_insert_n(string_t s, int index, const char *str, int count);
+void string_remove(string_t s, int count);
 void string_clear(string_t s);
 char *string_free(string_t s, int free_string);
 
 /* tablice stringow */
-char **array_make(const char *string, const char *sep, size_t max, int trim, int quotes);
+char **array_make(const char *string, const char *sep, int max, int trim, int quotes);
 char *array_join(char **array, const char *sep);
-char *array_join_count(char **array, const char *sep, size_t count);
+char *array_join_count(char **array, const char *sep, int count);
 
 void array_add(char ***array, char *string);
 void array_add_check(char ***array, char *string, int casesensitive);
@@ -131,7 +128,7 @@
 int array_contains(char **array, const char *string, int casesensitive);
 int array_item_contains(char **array, const char *string, int casesensitive);
 void array_free(char **array);
-void array_free_count(char **array, size_t count);
+void array_free_count(char **array, int count);
 
 /* rozszerzenia libców */
 

Modified: trunk/ekg/themes.h
===================================================================
--- trunk/ekg/themes.h	2008-03-03 12:32:49 UTC (rev 3835)
+++ trunk/ekg/themes.h	2008-03-03 13:36:16 UTC (rev 3836)
@@ -41,7 +41,7 @@
 	short		*attr;			/* atrybuty, ciąg o długości strlen(str) */
 	time_t		ts;			/* timestamp */
 
-	size_t		prompt_len;		/* długość promptu, który będzie powtarzany przy
+	int		prompt_len;		/* długość promptu, który będzie powtarzany przy
 						   przejściu do kolejnej linii. */
 	unsigned int	prompt_empty	: 1;	/* prompt przy przenoszeniu będzie pusty */
 	int		margin_left;		/* where the margin is set (on what char) */



Więcej informacji o liście dyskusyjnej ekg2-commit