about summary refs log tree commit diff stats
path: root/src/LYHistory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYHistory.c')
-rw-r--r--src/LYHistory.c70
1 files changed, 42 insertions, 28 deletions
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 8c88b753..28494879 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYHistory.c,v 1.73 2009/01/01 23:22:12 tom Exp $
+ * $LynxId: LYHistory.c,v 1.75 2009/06/07 16:57:43 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -344,7 +344,8 @@ void LYAllocHistory(int entries)
 	int save = size_history;
 
 	size_history = (entries + 2) * 2;
-	want = (unsigned) size_history * sizeof(*history);
+	want = (unsigned) size_history *sizeof(*history);
+
 	if (history == 0) {
 	    history = (HistInfo *) malloc(want);
 	} else {
@@ -955,16 +956,22 @@ int LYShowVisitedLinks(char **newfile)
 #ifndef STATUSBUFSIZE
 #define STATUSBUFSIZE   40
 #endif
-static char *buffstack[STATUSBUFSIZE];
+
+int status_buf_size = STATUSBUFSIZE;
+
+static char **buffstack;
 static int topOfStack = 0;
 
 #ifdef LY_FIND_LEAKS
 static void free_messages_stack(void)
 {
-    topOfStack = STATUSBUFSIZE;
+    if (buffstack != 0) {
+	topOfStack = status_buf_size;
 
-    while (--topOfStack >= 0) {
-	FREE(buffstack[topOfStack]);
+	while (--topOfStack >= 0) {
+	    FREE(buffstack[topOfStack]);
+	}
+	FREE(buffstack);
     }
 }
 #endif
@@ -974,13 +981,16 @@ static void to_stack(char *str)
     /*
      * Cycle buffer:
      */
-    if (topOfStack >= STATUSBUFSIZE) {
+    if (topOfStack >= status_buf_size) {
 	topOfStack = 0;
     }
 
     /*
      * Register string.
      */
+    if (buffstack == 0)
+	buffstack = typecallocn(char *, status_buf_size);
+
     FREE(buffstack[topOfStack]);
     buffstack[topOfStack] = str;
     topOfStack++;
@@ -990,7 +1000,7 @@ static void to_stack(char *str)
 	atexit(free_messages_stack);
     }
 #endif
-    if (topOfStack >= STATUSBUFSIZE) {
+    if (topOfStack >= status_buf_size) {
 	topOfStack = 0;
     }
 }
@@ -1006,22 +1016,24 @@ void LYstatusline_messages_on_exit(char **buf)
 {
     int i;
 
-    StrAllocCat(*buf, "\n");
-    /* print messages in chronological order:
-     * probably a single message but let's do it.
-     */
-    i = topOfStack - 1;
-    while (++i < STATUSBUFSIZE) {
-	if (buffstack[i] != NULL) {
-	    StrAllocCat(*buf, buffstack[i]);
-	    StrAllocCat(*buf, "\n");
+    if (buffstack != 0) {
+	StrAllocCat(*buf, "\n");
+	/* print messages in chronological order:
+	 * probably a single message but let's do it.
+	 */
+	i = topOfStack - 1;
+	while (++i < status_buf_size) {
+	    if (buffstack[i] != NULL) {
+		StrAllocCat(*buf, buffstack[i]);
+		StrAllocCat(*buf, "\n");
+	    }
 	}
-    }
-    i = -1;
-    while (++i < topOfStack) {
-	if (buffstack[i] != NULL) {
-	    StrAllocCat(*buf, buffstack[i]);
-	    StrAllocCat(*buf, "\n");
+	i = -1;
+	while (++i < topOfStack) {
+	    if (buffstack[i] != NULL) {
+		StrAllocCat(*buf, buffstack[i]);
+		StrAllocCat(*buf, "\n");
+	    }
 	}
     }
 }
@@ -1072,10 +1084,12 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED,
     int i;
     char *temp = NULL;
 
-    i = STATUSBUFSIZE;
-    while (--i >= 0) {
-	if (buffstack[i] != NULL)
-	    nummsg++;
+    if (buffstack != 0) {
+	i = status_buf_size;
+	while (--i >= 0) {
+	    if (buffstack[i] != NULL)
+		nummsg++;
+	}
     }
 
     /*
@@ -1121,7 +1135,7 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED,
 		PUTS(buf);
 	    }
 	}
-	i = STATUSBUFSIZE;
+	i = status_buf_size;
 	while (--i >= topOfStack) {
 	    if (buffstack[i] != NULL) {
 		StrAllocCopy(temp, buffstack[i]);
d=363be37f3f41db063ced940e310d6bba6ef82ef3'>363be37f ^
4071055a ^
dc1323e9 ^
363be37f ^
ac0e9db5 ^
4071055a ^
dc1323e9 ^
363be37f ^

ac0e9db5 ^
4071055a ^
dc1323e9 ^




363be37f ^
e4630643 ^



dc1323e9 ^
0f125d5f ^
dc1323e9 ^
e4630643 ^
827898fc ^
dc1323e9 ^






8ba8f0f6 ^
bc643692 ^
dc1323e9 ^









bc643692 ^

dc1323e9 ^









bc643692 ^

dc1323e9 ^




4071055a ^



bc643692 ^


8ba8f0f6 ^
bc643692 ^
4071055a ^
bc643692 ^
4071055a ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110