mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 17:10:59 +01:00
41527 (tweaked for heap memory): fix [[ -<cond> ]] from modules
This commit is contained in:
parent
0f8cf76ece
commit
b5f40f4156
3 changed files with 27 additions and 2 deletions
15
Src/module.c
15
Src/module.c
|
|
@ -649,11 +649,21 @@ getconddef(int inf, const char *name, int autol)
|
|||
{
|
||||
Conddef p;
|
||||
int f = 1;
|
||||
char *lookup, *s;
|
||||
|
||||
/* detokenize the Dash to the form encoded in lookup tables */
|
||||
lookup = dupstring(name);
|
||||
if (!lookup)
|
||||
return NULL;
|
||||
for (s = lookup; *s != '\0'; s++) {
|
||||
if (*s == Dash)
|
||||
*s = '-';
|
||||
}
|
||||
|
||||
do {
|
||||
for (p = condtab; p; p = p->next) {
|
||||
if ((!!inf == !!(p->flags & CONDF_INFIX)) &&
|
||||
!strcmp(name, p->name))
|
||||
!strcmp(lookup, p->name))
|
||||
break;
|
||||
}
|
||||
if (autol && p && p->module) {
|
||||
|
|
@ -664,7 +674,7 @@ getconddef(int inf, const char *name, int autol)
|
|||
if (f) {
|
||||
(void)ensurefeature(p->module,
|
||||
(p->flags & CONDF_INFIX) ? "C:" : "c:",
|
||||
(p->flags & CONDF_AUTOALL) ? NULL : name);
|
||||
(p->flags & CONDF_AUTOALL) ? NULL : lookup);
|
||||
f = 0;
|
||||
p = NULL;
|
||||
} else {
|
||||
|
|
@ -674,6 +684,7 @@ getconddef(int inf, const char *name, int autol)
|
|||
} else
|
||||
break;
|
||||
} while (!p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue