summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2016-11-24 15:50:56 +0100
committerOliver Kiddle <opk@zsh.org>2016-11-24 16:11:52 +0100
commit2e44ac72f645264a2b0dfdf9180c3ae49567c3c2 (patch)
tree47fb12a75fc9975ce9f0ac89cdadefc18aed9852
parent3570172d3be4e10549a9966b39f8cae762975bcd (diff)
downloadzsh-2e44ac72f645264a2b0dfdf9180c3ae49567c3c2.tar.gz
zsh-2e44ac72f645264a2b0dfdf9180c3ae49567c3c2.tar.xz
zsh-2e44ac72f645264a2b0dfdf9180c3ae49567c3c2.zip
unposted: fix to compile on Solaris where curses.h has a #define for reg to register
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_params.c18
2 files changed, 14 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bf059098..8a36017e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-24  Oliver Kiddle  <opk@zsh.org>
+
+	* unposted: Src/Zle/zle_params.c: fix to compile on Solaris where
+	curses.h has a #define for reg to register
+
 	* 40003: Src/Zle/zle_params.c, Doc/Zsh/zle.yo: include "0-"9
 	vi buffers in the registers associative array
 
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 78e78354f..1e4c5b832 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -730,7 +730,7 @@ set_register(Param pm, char *value)
 {
     int n = 0;
     int offset = -1;
-    Cutbuffer reg;
+    Cutbuffer vbuf;
 
     if (!pm->node.nam || pm->node.nam[1])
 	;
@@ -744,10 +744,10 @@ set_register(Param pm, char *value)
 	return;
     }
 
-    reg = &vibuf[*pm->node.nam - offset];
+    vbuf = &vibuf[*pm->node.nam - offset];
     if (*value)
-	reg->buf = stringaszleline(value, 0, &n, NULL, NULL);
-    reg->len = n;
+	vbuf->buf = stringaszleline(value, 0, &n, NULL, NULL);
+    vbuf->len = n;
 }
 
 /**/
@@ -785,7 +785,7 @@ static HashNode
 get_registers(UNUSED(HashTable ht), const char *name)
 {
     Param pm = (Param) hcalloc(sizeof(struct param));
-    int reg = -1;
+    int vbuf = -1;
     pm->node.nam = dupstring(name);
     pm->node.flags = PM_SCALAR;
     pm->gsu.s = &register_gsu;
@@ -793,15 +793,15 @@ get_registers(UNUSED(HashTable ht), const char *name)
     if (name[1])
        ;
     else if (*name >= '0' && *name <= '9')
-	reg = *name - '0' + 26;
+	vbuf = *name - '0' + 26;
     else if (*name >= 'a' && *name <= 'z')
-	reg = *name - 'a';
+	vbuf = *name - 'a';
 
-    if (reg == -1) {
+    if (vbuf == -1) {
 	pm->u.str = dupstring("");
 	pm->node.flags |= (PM_UNSET|PM_SPECIAL);
     } else
-	pm->u.str = zlelineasstring(vibuf[reg].buf, vibuf[reg].len, 0, NULL, NULL, 1);
+	pm->u.str = zlelineasstring(vibuf[vbuf].buf, vibuf[vbuf].len, 0, NULL, NULL, 1);
 
     return &pm->node;
 }