Mercurial > pidgin
view Makefile.mingw @ 11719:109ee3bfeac5
[gaim-migrate @ 14010]
SF Patch #1333770 from corfe83
"Many times in gaim we use the function
g_slist_remove(list,node->data) to remove an element
from a GSList. If we already have the pointer to the
node we want to delete, it is faster to send it the
pointer to the node to delete rather than the data of
the node (we can do this by calling
g_slist_delete_link(list,node)). This change was made
while looking at glib's documentation and the code in
glib's gslist.c.
This is because as the remove/delete function traverses
each node in the list, it doesn't need to spend an
extra memory access to retrieve the data for each
element in the node it is traversing and then compare,
it can simply compare the pointer. In my tests outside
of gaim, this makes a big difference if the node you
are deleting is at a high index in the list. However,
even if you're deleting the first node, it about breaks
even.
So, I've found each case in gaim where we are calling
g_slist_remove, and we already have the pointer to the
appropriate node to delete (this is often the case when
we're doing a for or while loop on a GSList). I've then
replaced it with the appropriate call to
g_slist_delete_link. I, however, didn't do this in
situations where we are explicitly removing the first
element in the list, because in those situations it is
an unnecessary change.
There should be no difference in behavior, but just in
case I've tried running it with valgrind, which reports
the same number of memory leaks after my patch as
before my patch. Of course, I can't guarantee that my
normal behavior on gaim is hitting all the functions
I've changed, but in general testing it Works For Me (tm)."
As with the last patch, this one may not have a practical performance impact (or maybe it does, I have no idea), but it's not worse for any case. Given two ways of doing things where one is always at least as fast and may be faster under some cases, I like to prefer that faster way. This doesn't make the code any uglier, so I'm applying.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sat, 22 Oct 2005 20:48:18 +0000 |
parents | 8b955ffe9584 |
children | 4d8023465af4 |
line wrap: on
line source
# Makefile.mingw # # Author: hermanator12002@yahoo.com # Date 9/11/02 # Description: Top Makefile for win32 (mingw) port of Gaim # GAIM_SRC = ./src GAIM_PROTOS = $(GAIM_SRC)/protocols GAIM_PLUGINS = ./plugins GAIM_PIXMAPS = ./pixmaps GAIM_SOUNDS = ./sounds GAIM_INSTALL_DIR = ./win32-install-dir GTKSPELL_TOP = ../win32-dev/gtkspell-2.0.6/gtkspell IDLETRACK_TOP = $(GAIM_SRC)/win32/IdleTracker GTKRC_TOP = ../win32-dev/gtkrc OSCAR = $(GAIM_PROTOS)/oscar YAHOO = $(GAIM_PROTOS)/yahoo MSN = $(GAIM_PROTOS)/msn TOC = $(GAIM_PROTOS)/toc IRC = $(GAIM_PROTOS)/irc JABBER = $(GAIM_PROTOS)/jabber NAPSTER = $(GAIM_PROTOS)/napster TREPIA = $(GAIM_PROTOS)/trepia GG = $(GAIM_PROTOS)/gg NOVELL = $(GAIM_PROTOS)/novell SILC = $(GAIM_PROTOS)/silc SIMPLE = $(GAIM_PROTOS)/simple SAMETIME = $(GAIM_PROTOS)/sametime PO = ./po MAKENSIS := makensis.exe VERSION := $(shell cat ./VERSION) NEEDED_DLLS = $(GTKSPELL_TOP)/libgtkspell.dll \ $(IDLETRACK_TOP)/idletrack.dll SOUNDS = $(GAIM_SOUNDS)/alert.wav \ $(GAIM_SOUNDS)/login.wav \ $(GAIM_SOUNDS)/logout.wav \ $(GAIM_SOUNDS)/receive.wav \ $(GAIM_SOUNDS)/send.wav ## ## Don't forget to change STATIC_PROTO_INIT, in config.h.mingw if you ## change the status of a protocol (static/plugin) ## OSCAR_TYPE = PLUGIN YAHOO_TYPE = PLUGIN MSN_TYPE = PLUGIN TOC_TYPE = PLUGIN IRC_TYPE = PLUGIN JABBER_TYPE = PLUGIN NAPSTER_TYPE = PLUGIN GG_TYPE = PLUGIN NOVELL_TYPE = PLUGIN TREPIA_TYPE = PLUGIN SILC_TYPE = PLUGIN SIMPLE_TYPE = PLUGIN SAMETIME_TYPE = PLUGIN all: cp config.h.mingw config.h $(MAKE) TYPE='$(OSCAR_TYPE)' -C $(OSCAR) -f Makefile.mingw $(MAKE) TYPE='$(YAHOO_TYPE)' -C $(YAHOO) -f Makefile.mingw $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw $(MAKE) TYPE='$(NAPSTER_TYPE)' -C $(NAPSTER) -f Makefile.mingw $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw $(MAKE) TYPE='$(SIMPLE_TYPE)' -C $(SIMPLE) -f Makefile.mingw $(MAKE) TYPE='$(SAMETIME_TYPE)' -C $(SAMETIME) -f Makefile.mingw $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw install: all mkdir -p $(GAIM_INSTALL_DIR)/plugins mkdir -p $(GAIM_INSTALL_DIR)/sounds/gaim $(MAKE) -C $(GAIM_PIXMAPS) -f Makefile.mingw install $(MAKE) -C $(PO) -f Makefile.mingw install $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw install $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw install $(MAKE) TYPE='$(OSCAR_TYPE)' -C $(OSCAR) -f Makefile.mingw install $(MAKE) TYPE='$(YAHOO_TYPE)' -C $(YAHOO) -f Makefile.mingw install $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw install $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw install $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw install $(MAKE) TYPE='$(NAPSTER_TYPE)' -C $(NAPSTER) -f Makefile.mingw install $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw install $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw install $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw install $(MAKE) TYPE='$(SIMPLE_TYPE)' -C $(SIMPLE) -f Makefile.mingw install $(MAKE) TYPE='$(SAMETIME_TYPE)' -C $(SAMETIME) -f Makefile.mingw install cp $(NEEDED_DLLS) $(GAIM_INSTALL_DIR) cp $(SOUNDS) $(GAIM_INSTALL_DIR)/sounds/gaim installer: $(MAKENSIS) /DGAIM_VERSION="$(VERSION)" /DWITH_GTK gaim-installer.nsi installer_nogtk: $(MAKENSIS) /DGAIM_VERSION="$(VERSION)" gaim-installer.nsi installer_debug: $(MAKENSIS) /DGAIM_VERSION="$(VERSION)" /DDEBUG gaim-installer.nsi installers: installer installer_nogtk clean: $(MAKE) -C $(PO) -f Makefile.mingw clean $(MAKE) -C $(OSCAR) -f Makefile.mingw clean $(MAKE) -C $(YAHOO) -f Makefile.mingw clean $(MAKE) -C $(MSN) -f Makefile.mingw clean $(MAKE) -C $(IRC) -f Makefile.mingw clean $(MAKE) -C $(JABBER) -f Makefile.mingw clean $(MAKE) -C $(NAPSTER) -f Makefile.mingw clean $(MAKE) -C $(GG) -f Makefile.mingw clean $(MAKE) -C $(NOVELL) -f Makefile.mingw clean $(MAKE) -C $(SILC) -f Makefile.mingw clean $(MAKE) -C $(SIMPLE) -f Makefile.mingw clean $(MAKE) -C $(SAMETIME) -f Makefile.mingw clean $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw clean $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw clean rm -rf config.h $(GAIM_INSTALL_DIR) rm -rf gaim*.exe