patches with bugfixes for autobackup

Tommy Pettersson <[email protected]> Tue, 30 Nov 2004 23:39:57 +0100
Newsgroups gmane.editors.wily
Message-ID <[email protected]>
I send this as a separate mail, since it only concerns the
autobackup creature I've made.  It fixes two bugs and makes
one improvement, in case anyone would happen to be using it.

Patches against wily-9libs 0.13.41 + original autobackup patch.

* Free data->backupname, fix memory leak.
* Remove unneeded backups after an Undo-all and before a Quit.
* Better placement of suspend_gtimer() in follow().

diff -rN -u diff-old/wily-9libs/wily/data.c diff-new/wily-9libs/wily/data.c
--- diff-old/wily-9libs/wily/data.c	Tue Nov 30 22:27:01 2004
+++ diff-new/wily-9libs/wily/data.c	Tue Nov 30 22:22:27 2004
@@ -125,6 +125,8 @@
 	dirnames_free(d->names);
 	if(d->backupto)
 		free(d->backupto);
+	if(d->backupname)
+		free(d->backupname);
 	free(d);
 	return 0;
 }
@@ -132,6 +134,8 @@
 /* Backup 'd' if necessary.  Return 0 for success. */
 int
 data_backup(Data *d) {
+	if (!NEEDSBACKUP(d))
+		data_rmbackup(d);
 	if (!NEEDSBUPDATE(d))
 		return 0;
 
diff -rN -u diff-old/wily-9libs/wily/select.c diff-new/wily-9libs/wily/select.c
--- diff-old/wily-9libs/wily/select.c	Tue Nov 30 22:27:01 2004
+++ diff-new/wily-9libs/wily/select.c	Tue Nov 30 22:22:27 2004
@@ -119,7 +119,6 @@
 	ulong	type, timer=0;
 	SelFn 	fn;
 	
-	suspend_gtimer();
 	fn = selecting? frselectf : frselectf2;
 	toggle(v, fn, p0, p1);
 	v->selecting = true;
@@ -142,7 +141,7 @@
 				if(timer == type || timer == 0)
 					move(v, fn, m->xy, p0, p1);
 				if (timer==0)
-					timer = etimer(0, SCROLLTIME);
+					suspend_gtimer(), timer = etimer(0, SCROLLTIME);
 			}
 		}
 		if(q != oldq && p1 != q){



-- 
Tommy Pettersson <[email protected]>