[ekg2-commit] r4742 - in branches/c++_renames: ekg plugins/irc: branches/c++_renames/ekg/dynstuff.c branches/c++_renames/ekg/dynstuff.h branches/c++_renames/ekg/dynstuff_inline.h branches/c++_renames/plugins/irc/people.c branches/c++_renames/plugins/irc/people.h

SVN commit svn w toxygen.net
Śro, 26 Lis 2008, 20:52:19 CET


Author: porridge
Date: 2008-11-26 20:52:19 +0100 (Wed, 26 Nov 2008)
New Revision: 4742

Modified:
   branches/c++_renames/ekg/dynstuff.c
   branches/c++_renames/ekg/dynstuff.h
   branches/c++_renames/ekg/dynstuff_inline.h
   branches/c++_renames/plugins/irc/people.c
   branches/c++_renames/plugins/irc/people.h
Log:
Rename 'new' to 'new_' or 'new_nick', depending on the context.
This is so that c++ compilers can parse our headers.


Modified: branches/c++_renames/ekg/dynstuff.c
===================================================================
--- branches/c++_renames/ekg/dynstuff.c	2008-11-26 19:04:24 UTC (rev 4741)
+++ branches/c++_renames/ekg/dynstuff.c	2008-11-26 19:52:19 UTC (rev 4742)
@@ -44,30 +44,30 @@
  */
 void *list_add_sorted(list_t *list, void *data, int (*comparision)(void *, void *))
 {
-	list_t new, tmp;
+	list_t new_, tmp;
 
 	if (!list) {
 		errno = EFAULT;
 		return NULL;
 	}
 
-	new = xmalloc(sizeof(struct list));
+	new_ = xmalloc(sizeof(struct list));
 
-	new->data = data;
-	new->next = NULL;
-	/*new->prev = NULL;*/
+	new_->data = data;
+	new_->next = NULL;
+	/*new_->prev = NULL;*/
 
 	if (!(tmp = *list)) {
-		*list = new;
+		*list = new_;
 	} else {
 		if (!comparision) {
 			while (tmp->next)
 				tmp = tmp->next;
-			tmp->next = new;
+			tmp->next = new_;
 		} else {
 			list_t prev = NULL;
 			
-			while (comparision(new->data, tmp->data) > 0) {
+			while (comparision(new_->data, tmp->data) > 0) {
 				prev = tmp;
 				tmp = tmp->next;
 				if (!tmp)
@@ -75,16 +75,16 @@
 			}
 			
 			if (!prev) {
-				new->next = *list;
-				*list = new;
+				new_->next = *list;
+				*list = new_;
 			} else {
-				prev->next = new;
-				new->next = tmp;
+				prev->next = new_;
+				new_->next = tmp;
 			}
 		}
 	}
 
-	return new->data;
+	return new_->data;
 }
 
 /**
@@ -99,20 +99,20 @@
 
 void *list_add_beginning(list_t *list, void *data) {
 
-	list_t new;
+	list_t new_;
 
 	if (!list) {
 		errno = EFAULT;
 		return NULL;
 	}
 
-	new = xmalloc(sizeof(struct list));
-	new->next = *list;
-	*list	  = new;
+	new_ = xmalloc(sizeof(struct list));
+	new_->next = *list;
+	*list	  = new_;
 
-	new->data = data;
+	new_->data = data;
 
-	return new->data;
+	return new_->data;
 
 }
 
@@ -133,7 +133,7 @@
 	return list_add_sorted(list, data, NULL);
 }
 
-void *list_add_sorted3(list_t *list, list_t new, int (*comparision)(void *, void *))
+void *list_add_sorted3(list_t *list, list_t new_, int (*comparision)(void *, void *))
 {
 	list_t tmp;
 
@@ -142,18 +142,18 @@
 		return NULL;
 	}
 
-	new->next = NULL;
+	new_->next = NULL;
 	if (!(tmp = *list)) {
-		*list = new;
+		*list = new_;
 	} else {
 		if (!comparision) {
 			while (tmp->next)
 				tmp = tmp->next;
-			tmp->next = new;
+			tmp->next = new_;
 		} else {
 			list_t prev = NULL;
 			
-			while (comparision(new, tmp) > 0) {
+			while (comparision(new_, tmp) > 0) {
 				prev = tmp;
 				tmp = tmp->next;
 				if (!tmp)
@@ -161,35 +161,35 @@
 			}
 			
 			if (!prev) {
-				new->next = *list;
-				*list = new;
+				new_->next = *list;
+				*list = new_;
 			} else {
-				prev->next = new;
-				new->next = tmp;
+				prev->next = new_;
+				new_->next = tmp;
 			}
 		}
 	}
 
-	return new;
+	return new_;
 }
 
-void *list_add_beginning3(list_t *list, list_t new)
+void *list_add_beginning3(list_t *list, list_t new_)
 {
 	if (!list) {
 		errno = EFAULT;
 		return NULL;
 	}
 
-	new->next = *list;
-	*list	  = new;
+	new_->next = *list;
+	*list	  = new_;
 
-	return new;
+	return new_;
 
 }
 
-void *list_add3(list_t *list, list_t new)
+void *list_add3(list_t *list, list_t new_)
 {
-	return list_add_sorted3(list, new, NULL);
+	return list_add_sorted3(list, new_, NULL);
 }
 
 /**

Modified: branches/c++_renames/ekg/dynstuff.h
===================================================================
--- branches/c++_renames/ekg/dynstuff.h	2008-11-26 19:04:24 UTC (rev 4741)
+++ branches/c++_renames/ekg/dynstuff.h	2008-11-26 19:52:19 UTC (rev 4742)
@@ -100,9 +100,9 @@
 void *list_add_beginning(list_t *list, void *data);
 void *list_add_sorted(list_t *list, void *data, int (*comparision)(void *, void *));
 
-void *list_add3(list_t *list, list_t new);
-void *list_add_beginning3(list_t *list, list_t new);
-void *list_add_sorted3(list_t *list, list_t new, int (*comparision)(void *, void *));
+void *list_add3(list_t *list, list_t new_);
+void *list_add_beginning3(list_t *list, list_t new_);
+void *list_add_sorted3(list_t *list, list_t new_, int (*comparision)(void *, void *));
 
 
 int list_count(list_t list);

Modified: branches/c++_renames/ekg/dynstuff_inline.h
===================================================================
--- branches/c++_renames/ekg/dynstuff_inline.h	2008-11-26 19:04:24 UTC (rev 4741)
+++ branches/c++_renames/ekg/dynstuff_inline.h	2008-11-26 19:52:19 UTC (rev 4742)
@@ -16,13 +16,13 @@
 #if DYNSTUFF_USE_LIST3
 
 #define __DYNSTUFF_LIST_ADD(lista, typ, __notused)		\
-	void lista##_add(typ *new) { list_add3((list_t *) (void *) &lista, (list_t) new); }
+	void lista##_add(typ *new_) { list_add3((list_t *) (void *) &lista, (list_t) new_); }
 
 #define __DYNSTUFF_LIST_ADD_BEGINNING(lista, typ, __notused)	\
-	void lista##_add(typ *new) { list_add_beginning3((list_t *) (void *) &lista, (list_t) new); }
+	void lista##_add(typ *new_) { list_add_beginning3((list_t *) (void *) &lista, (list_t) new_); }
 
 #define __DYNSTUFF_LIST_ADD_SORTED(lista, typ, comparision)	\
-	void lista##_add(typ *new) { list_add_sorted3((list_t *) (void *) &lista, (list_t) new, (void *) comparision); }
+	void lista##_add(typ *new_) { list_add_sorted3((list_t *) (void *) &lista, (list_t) new_, (void *) comparision); }
 
 #define __DYNSTUFF_LIST_REMOVE_SAFE(lista, typ, free_func)	\
 	void lista##_remove(typ *elem) { list_remove3((list_t *) (void *) &lista, (list_t) elem, (void *) free_func); }
@@ -42,35 +42,35 @@
 #else
 
 #define __DYNSTUFF_LIST_ADD(lista, typ, __notused)		\
-	void lista##_add(typ *new) {				\
-		new->next = NULL;				\
+	void lista##_add(typ *new_) {				\
+		new_->next = NULL;				\
 		if (!lista) {					\
-			lista = new;				\
+			lista = new_;				\
 		} else {					\
 			typ *tmp = lista;			\
 								\
 			while (tmp->next)			\
 				tmp = tmp->next;		\
-			tmp->next = new;			\
+			tmp->next = new_;			\
 		}						\
 }
 
 #define __DYNSTUFF_LIST_ADD_BEGINNING(lista, typ, __notused)	\
-	void lista##_add(typ *new) {				\
-		new->next = lista;				\
-		lista  = new;					\
+	void lista##_add(typ *new_) {				\
+		new_->next = lista;				\
+		lista  = new_;					\
 	}
 
 #define __DYNSTUFF_LIST_ADD_SORTED(lista, typ, comparision)	\
-	void lista##_add(typ *new) {				\
-		new->next = NULL;				\
+	void lista##_add(typ *new_) {				\
+		new_->next = NULL;				\
 		if (!lista) {					\
-			lista = new;				\
+			lista = new_;				\
 		} else {					\
 			typ *tmp = lista;			\
 			typ *prev = NULL;			\
 								\
-			while (comparision(new, tmp) > 0) {	\
+			while (comparision(new_, tmp) > 0) {	\
 				prev = tmp;			\
 				tmp = tmp->next;		\
 				if (!tmp)			\
@@ -78,11 +78,11 @@
 			}					\
 								\
 			if (!prev) {				\
-				new->next = lista;		\
-				lista = new;			\
+				new_->next = lista;		\
+				lista = new_;			\
 			} else {				\
-				prev->next = new;		\
-				new->next = tmp;		\
+				prev->next = new_;		\
+				new_->next = tmp;		\
 			}					\
 		}						\
 	}
@@ -191,13 +191,13 @@
 #if DYNSTUFF_USE_LIST3
 
 #define __DYNSTUFF_ADD(prefix, typ, __notused)		\
-	void prefix##_add(typ **lista, typ *new) { list_add3((list_t *) lista, (list_t) new); }
+	void prefix##_add(typ **lista, typ *new_) { list_add3((list_t *) lista, (list_t) new_); }
 
 #define __DYNSTUFF_ADD_BEGINNING(prefix, typ, __notused) \
-	void prefix##_add(typ **lista, typ *new) { list_add_beginning3((list_t *) lista, (list_t) new); }
+	void prefix##_add(typ **lista, typ *new_) { list_add_beginning3((list_t *) lista, (list_t) new_); }
 
 #define __DYNSTUFF_ADD_SORTED(prefix, typ, comparision) \
-	void prefix##_add(typ **lista, typ *new) { list_add_sorted3((list_t *) lista, (list_t) new, (void *) comparision); }
+	void prefix##_add(typ **lista, typ *new_) { list_add_sorted3((list_t *) lista, (list_t) new_, (void *) comparision); }
 
 #define __DYNSTUFF_REMOVE_SAFE(prefix, typ, free_func)					\
 	void prefix##_remove(typ **lista, typ *elem) {					\
@@ -229,36 +229,36 @@
 	/* XXX, checkit */
 
 #define __DYNSTUFF_ADD(prefix, typ, __notused)			\
-	void prefix##_add(typ **lista, typ *new) {		\
+	void prefix##_add(typ **lista, typ *new_) {		\
 		typ *tmp = *lista;				\
 								\
-		new->next = NULL;				\
+		new_->next = NULL;				\
 		if (!(tmp = *lista)) {				\
-			*lista = new;				\
+			*lista = new_;				\
 		} else {					\
 			while (tmp->next)			\
 				tmp = tmp->next;		\
-			tmp->next = new;			\
+			tmp->next = new_;			\
 		}						\
 }
 
 #define __DYNSTUFF_ADD_BEGINNING(prefix, typ, __notused)	\
-	void prefix##_add(typ **lista, typ *new) {		\
-		new->next = *lista;				\
-		*lista	= new;					\
+	void prefix##_add(typ **lista, typ *new_) {		\
+		new_->next = *lista;				\
+		*lista	= new_;					\
 	}
 
 #define __DYNSTUFF_ADD_SORTED(prefix, typ, comparision)		\
-	void prefix##_add(typ **lista, typ *new) {		\
+	void prefix##_add(typ **lista, typ *new_) {		\
 		typ *tmp;					\
 								\
-		new->next = NULL;				\
+		new_->next = NULL;				\
 		if (!(tmp = *lista)) {				\
-			*lista = new;				\
+			*lista = new_;				\
 		} else {					\
 			typ *prev = NULL;			\
 								\
-			while (comparision(new, tmp) > 0) {	\
+			while (comparision(new_, tmp) > 0) {	\
 				prev = tmp;			\
 				tmp = tmp->next;		\
 				if (!tmp)			\
@@ -266,11 +266,11 @@
 			}					\
 								\
 			if (!prev) {				\
-				new->next = *lista;		\
-				*lista = new;			\
+				new_->next = *lista;		\
+				*lista = new_;			\
 			} else {				\
-				prev->next = new;		\
-				new->next = tmp;		\
+				prev->next = new_;		\
+				new_->next = tmp;		\
 			}					\
 		}						\
 	}

Modified: branches/c++_renames/plugins/irc/people.c
===================================================================
--- branches/c++_renames/plugins/irc/people.c	2008-11-26 19:04:24 UTC (rev 4741)
+++ branches/c++_renames/plugins/irc/people.c	2008-11-26 19:52:19 UTC (rev 4742)
@@ -566,14 +566,14 @@
  *
  * @param s - current session structure
  * @param j - irc priv_data structure of current session
- * @param old - old nickname of user without <em>'irc:'</em>
+ * @param old_nick - old nickname of user without <em>'irc:'</em>
  *   prefix, and WITHOUT '@%+' prefix
- * @param new - new nickname of user without <em>'irc:'</em>
+ * @param new_nick - new nickname of user without <em>'irc:'</em>
  *   prefix, and WITHOUT '@%+' prefix
  *
  * @return	0
  */
-int irc_nick_change(session_t *s, irc_private_t *j, char *old, char *new)
+int irc_nick_change(session_t *s, irc_private_t *j, char *old_nick, char *new_nick)
 {
 	userlist_t *ulist, *newul;
 	list_t i;
@@ -581,9 +581,9 @@
 	people_t *per;
 	people_chan_t *pch;
 	window_t *w;
-	char *t1, *t2 = irc_uid(new);
+	char *t1, *t2 = irc_uid(new_nick);
 
-	if (!(per = irc_find_person(j->people, old))) {
+	if (!(per = irc_find_person(j->people, old_nick))) {
 		debug_error("irc_nick_change() person not found?\n");
 		xfree(t2);
 		return 0;
@@ -611,8 +611,8 @@
 		pch = (people_chan_t *)i->data;
 
 		w = window_find_s(s, pch->chanp->name);
-		if (w && (ulist = userlist_find_u(&(w->userlist), old))) {
-			newul = userlist_add_u(&(w->userlist), t2, new);
+		if (w && (ulist = userlist_find_u(&(w->userlist), old_nick))) {
+			newul = userlist_add_u(&(w->userlist), t2, new_nick);
 			newul->status = ulist->status;
 			userlist_remove_u(&(w->userlist), ulist);
 			/* XXX dj, userlist_replace() */
@@ -634,11 +634,11 @@
 		/* if person who changed nick had longest nick,
 		 * update longest_nick variable
 		 */
-		if (xstrlen(new) > pch->chanp->longest_nick)
+		if (xstrlen(new_nick) > pch->chanp->longest_nick)
 		{
-			pch->chanp->longest_nick = xstrlen(new);
+			pch->chanp->longest_nick = xstrlen(new_nick);
 			nickpad_string_create(pch->chanp);
-		} else if (xstrlen(old) == pch->chanp->longest_nick)
+		} else if (xstrlen(old_nick) == pch->chanp->longest_nick)
 			update_longest_nick (pch->chanp);
 	}
 

Modified: branches/c++_renames/plugins/irc/people.h
===================================================================
--- branches/c++_renames/plugins/irc/people.h	2008-11-26 19:04:24 UTC (rev 4741)
+++ branches/c++_renames/plugins/irc/people.h	2008-11-26 19:52:19 UTC (rev 4742)
@@ -42,7 +42,7 @@
 channel_t *irc_add_channel(session_t *s, irc_private_t *j, char *name,
 		window_t *win);
 
-int irc_nick_change(session_t *s, irc_private_t *j, char *old, char *new);
+int irc_nick_change(session_t *s, irc_private_t *j, char *old_nick, char *new_nick);
 int irc_nick_prefix(irc_private_t *j, people_chan_t *ch, int irc_color);
 int irc_color_in_contacts(char *modes, int mode, userlist_t *ul);
 



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