mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
zsh-workers/9329
This commit is contained in:
parent
5916a06121
commit
3250a1932b
5 changed files with 22 additions and 12 deletions
|
@ -58,7 +58,7 @@ createspecialhash(char *name, GetNodeFunc get, ScanTabFunc scan)
|
|||
pm->gets.hfn = hashgetfn;
|
||||
pm->sets.hfn = hashsetfn;
|
||||
pm->unsetfn = stdunsetfn;
|
||||
pm->u.hash = ht = newhashtable(7, name, NULL);
|
||||
pm->u.hash = ht = newhashtable(0, name, NULL);
|
||||
|
||||
ht->hash = hasher;
|
||||
ht->emptytable = (TableFunc) shempty;
|
||||
|
|
|
@ -1133,14 +1133,21 @@ static void
|
|||
compunsetfn(Param pm, int exp)
|
||||
{
|
||||
if (exp) {
|
||||
if (PM_TYPE(pm->flags) == PM_SCALAR) {
|
||||
zsfree(*((char **) pm->u.data));
|
||||
*((char **) pm->u.data) = ztrdup("");
|
||||
} else if (PM_TYPE(pm->flags) == PM_ARRAY) {
|
||||
freearray(*((char ***) pm->u.data));
|
||||
*((char ***) pm->u.data) = zcalloc(sizeof(char *));
|
||||
if (pm->u.data) {
|
||||
if (PM_TYPE(pm->flags) == PM_SCALAR) {
|
||||
zsfree(*((char **) pm->u.data));
|
||||
*((char **) pm->u.data) = ztrdup("");
|
||||
} else if (PM_TYPE(pm->flags) == PM_ARRAY) {
|
||||
freearray(*((char ***) pm->u.data));
|
||||
*((char ***) pm->u.data) = zcalloc(sizeof(char *));
|
||||
} else if (PM_TYPE(pm->flags) == PM_HASHED) {
|
||||
deleteparamtable(pm->u.hash);
|
||||
pm->u.hash = NULL;
|
||||
}
|
||||
}
|
||||
pm->flags |= PM_UNSET;
|
||||
} else if (PM_TYPE(pm->flags) == PM_HASHED) {
|
||||
deletehashtable(pm->u.hash);
|
||||
pm->u.hash = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ createspecialhash(char *name, GetNodeFunc get, ScanTabFunc scan)
|
|||
pm->gets.hfn = hashgetfn;
|
||||
pm->sets.hfn = hashsetfn;
|
||||
pm->unsetfn = stdunsetfn;
|
||||
pm->u.hash = ht = newhashtable(7, name, NULL);
|
||||
pm->u.hash = ht = newhashtable(0, name, NULL);
|
||||
|
||||
ht->hash = hasher;
|
||||
ht->emptytable = (TableFunc) shempty;
|
||||
|
|
|
@ -179,12 +179,15 @@ static struct globdata curglobdata;
|
|||
memcpy(&(N), &curglobdata, sizeof(struct globdata)); \
|
||||
(N).gd_pathpos = pathpos; \
|
||||
(N).gd_pathbuf = pathbuf; \
|
||||
(N).gd_pathbufsz = 0; \
|
||||
(N).gd_pathbuf = NULL; \
|
||||
(N).gd_glob_pre = glob_pre; \
|
||||
(N).gd_glob_suf = glob_suf; \
|
||||
} while (0)
|
||||
|
||||
#define restore_globstate(N) \
|
||||
do { \
|
||||
zfree(pathbuf, pathbufsz); \
|
||||
memcpy(&curglobdata, &(N), sizeof(struct globdata)); \
|
||||
pathpos = (N).gd_pathpos; \
|
||||
pathbuf = (N).gd_pathbuf; \
|
||||
|
|
|
@ -689,8 +689,8 @@ struct m_hdr {
|
|||
* back; note that this has to be less than M_FREE
|
||||
* M_ALLOC is the number of extra bytes to request from the system */
|
||||
|
||||
#define M_FREE 65536
|
||||
#define M_KEEP 32768
|
||||
#define M_FREE 32768
|
||||
#define M_KEEP 16384
|
||||
#define M_ALLOC M_KEEP
|
||||
|
||||
/* a pointer to the last free block, a pointer to the free list (the blocks
|
||||
|
@ -737,7 +737,7 @@ static char *m_high, *m_low;
|
|||
#define M_BSLEN(S) (((S) - sizeof(struct m_shdr *) - \
|
||||
sizeof(zlong) - sizeof(struct m_hdr *)) / M_SNUM)
|
||||
#endif
|
||||
#define M_NSMALL 13
|
||||
#define M_NSMALL 8
|
||||
|
||||
static struct m_hdr *m_small[M_NSMALL];
|
||||
|
||||
|
|
Loading…
Reference in a new issue