Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
6e26d7b6
...
6e26d7b6efb362188f693690949f099c43241ab7
authored
2002-11-25 15:48:57 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use sieve_m.* memory allocation functions.
1 parent
35ddbb9e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
libsieve/comparator.c
libsieve/prog.c
libsieve/sieve.l
libsieve/sieve.y
libsieve/comparator.c
View file @
6e26d7b
...
...
@@ -50,7 +50,7 @@ sieve_register_comparator (sieve_machine_t mach,
return
rc
;
}
rp
=
sieve_
palloc
(
&
mach
->
memory_pool
,
sizeof
(
*
rp
));
rp
=
sieve_
malloc
(
mach
,
sizeof
(
*
rp
));
rp
->
required
=
required
;
rp
->
name
=
name
;
rp
->
comp
[
MU_SIEVE_MATCH_IS
]
=
is
;
...
...
@@ -154,7 +154,7 @@ _regex_compile (void *item, void *data)
{
struct
regex_data
*
rd
=
data
;
int
rc
;
regex_t
*
preg
=
sieve_
palloc
(
&
sieve_machine
->
memory_pool
,
sizeof
(
*
preg
));
regex_t
*
preg
=
sieve_
malloc
(
sieve_machine
,
sizeof
(
*
preg
));
rc
=
regcomp
(
preg
,
(
char
*
)
item
,
rd
->
flags
);
if
(
rc
)
...
...
@@ -263,12 +263,11 @@ sieve_match_part_checker (const char *name, list_t tags, list_t args)
if
(
comp
)
{
sieve_
pfree
(
&
sieve_machine
->
memory_pool
,
comp
->
arg
);
sieve_
mfree
(
sieve_machine
,
comp
->
arg
);
}
else
{
comp
=
sieve_palloc
(
&
sieve_machine
->
memory_pool
,
sizeof
(
*
comp
));
comp
=
sieve_malloc
(
sieve_machine
,
sizeof
(
*
comp
));
comp
->
tag
=
"comparator"
;
list_append
(
tags
,
comp
);
}
...
...
libsieve/prog.c
View file @
6e26d7b
...
...
@@ -29,8 +29,7 @@ sieve_code (sieve_op_t *op)
if
(
sieve_machine
->
pc
>=
sieve_machine
->
progsize
)
{
size_t
newsize
=
sieve_machine
->
progsize
+
SIEVE_CODE_INCR
;
sieve_op_t
*
newprog
=
sieve_prealloc
(
&
sieve_machine
->
memory_pool
,
sieve_machine
->
prog
,
sieve_op_t
*
newprog
=
sieve_mrealloc
(
sieve_machine
,
sieve_machine
->
prog
,
newsize
*
sizeof
sieve_machine
->
prog
[
0
]);
if
(
!
newprog
)
...
...
@@ -198,8 +197,7 @@ sieve_code_command (sieve_register_t *reg, list_t arglist)
else
tagrec
.
arg
=
NULL
;
tagptr
=
sieve_palloc
(
&
sieve_machine
->
memory_pool
,
sizeof
(
*
tagptr
));
tagptr
=
sieve_malloc
(
sieve_machine
,
sizeof
(
*
tagptr
));
*
tagptr
=
tagrec
;
list_append
(
tag_list
,
tagptr
);
...
...
@@ -235,7 +233,7 @@ sieve_code_command (sieve_register_t *reg, list_t arglist)
list_create
(
&
list
);
list_append
(
list
,
val
->
v
.
string
);
sieve_
pfree
(
&
sieve_machine
->
memory_pool
,
val
);
sieve_
mfree
(
sieve_machine
,
val
);
val
=
sieve_value_create
(
SVT_STRING_LIST
,
list
);
}
else
...
...
libsieve/sieve.l
View file @
6e26d7b
...
...
@@ -444,7 +444,7 @@ number ()
int
string ()
{
yylval.string = sieve_
palloc (&sieve_machine->memory_pool
, yyleng - 1);
yylval.string = sieve_
malloc (sieve_machine
, yyleng - 1);
memcpy (yylval.string, yytext + 1, yyleng - 2);
yylval.string[yyleng - 2] = 0;
return STRING;
...
...
@@ -497,7 +497,7 @@ multiline_finish ()
}
/* Copy the contents */
yylval.string = sieve_
palloc (&sieve_machine->memory_pool
, length + 1);
yylval.string = sieve_
malloc (sieve_machine
, length + 1);
p = yylval.string;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
...
...
libsieve/sieve.y
View file @
6e26d7b
...
...
@@ -435,7 +435,7 @@ sieve_get_daemon_email (sieve_machine_t mach)
const char *domain = NULL;
mu_get_user_email_domain (&domain);
mach->daemon_email = sieve_
palloc (&mach->memory_pool
,
mach->daemon_email = sieve_
malloc (mach
,
sizeof(MAILER_DAEMON_PFX) +
strlen (domain));
sprintf (mach->daemon_email, "%s%s", MAILER_DAEMON_PFX, domain);
...
...
@@ -446,8 +446,8 @@ sieve_get_daemon_email (sieve_machine_t mach)
void
sieve_set_daemon_email (sieve_machine_t mach, const char *email)
{
sieve_
pfree (&mach->memory_pool
, (void *)mach->daemon_email);
mach->daemon_email = sieve_
pstrdup (&mach->memory_pool
, email);
sieve_
mfree (mach
, (void *)mach->daemon_email);
mach->daemon_email = sieve_
mstrdup (mach
, email);
}
struct sieve_destr_record
...
...
@@ -464,12 +464,12 @@ sieve_machine_add_destructor (sieve_machine_t mach, sieve_destructor_t destr,
if (!mach->destr_list && list_create (&mach->destr_list))
return 1;
p = sieve_
palloc (&mach->memory_pool
, sizeof (*p));
p = sieve_
malloc (mach
, sizeof (*p));
if (!p)
return 1;
p->destr = destr;
p->ptr = ptr;
return list_append (mach->
memory_pool
, p);
return list_append (mach->
destr_list
, p);
}
static int
...
...
@@ -524,16 +524,18 @@ sieve_compile (sieve_machine_t mach, const char *name)
if (sieve_lex_begin (name) == 0)
{
sieve_machine->filename = sieve_pstrdup (&sieve_machine->memory_pool,
name);
sieve_machine->filename = sieve_mstrdup (sieve_machine, name);
rc = yyparse ();
if (sieve_error_count)
rc = 1;
sieve_lex_finish ();
}
else
rc = 1;
sieve_machine_finish (mach);
if (
sieve_error_count
)
rc = 1
;
if (
rc
)
sieve_machine_destroy (&mach)
;
return rc;
}
...
...
Please
register
or
sign in
to post a comment