From 2e44ac72f645264a2b0dfdf9180c3ae49567c3c2 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 24 Nov 2016 15:50:56 +0100 Subject: unposted: fix to compile on Solaris where curses.h has a #define for reg to register --- ChangeLog | 5 +++++ Src/Zle/zle_params.c | 18 +++++++++--------- 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 + + * 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 = ®ister_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; } -- cgit 1.4.1