(mu_sieve_machine_inherit_report, mu_sieve_machine_dup): New functions
Showing
1 changed file
with
56 additions
and
2 deletions
1 | %{ | 1 | %{ |
2 | /* GNU Mailutils -- a suite of utilities for electronic mail | 2 | /* GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. | 3 | Copyright (C) 1999, 2000, 2001, 2002, 2005, |
4 | 2006 Free Software Foundation, Inc. | ||
4 | 5 | ||
5 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of the GNU Lesser General Public |
... | @@ -368,6 +369,58 @@ mu_sieve_machine_init (mu_sieve_machine_t *pmach, void *data) | ... | @@ -368,6 +369,58 @@ mu_sieve_machine_init (mu_sieve_machine_t *pmach, void *data) |
368 | } | 369 | } |
369 | 370 | ||
370 | void | 371 | void |
372 | mu_sieve_machine_inherit_report (mu_sieve_machine_t child, | ||
373 | mu_sieve_machine_t parent) | ||
374 | { | ||
375 | child->logger = parent->logger; | ||
376 | child->debug = parent->debug; | ||
377 | child->debug_level = parent->debug_level; | ||
378 | child->debug_printer = parent->debug_printer; | ||
379 | } | ||
380 | |||
381 | int | ||
382 | mu_sieve_machine_dup (mu_sieve_machine_t const in, mu_sieve_machine_t *out) | ||
383 | { | ||
384 | int rc; | ||
385 | mu_sieve_machine_t mach; | ||
386 | |||
387 | mach = malloc (sizeof (*mach)); | ||
388 | if (!mach) | ||
389 | return ENOMEM; | ||
390 | memset (mach, 0, sizeof (*mach)); | ||
391 | rc = mu_list_create (&mach->memory_pool); | ||
392 | if (rc) | ||
393 | { | ||
394 | free (mach); | ||
395 | return rc; | ||
396 | } | ||
397 | mach->destr_list = NULL; | ||
398 | mach->test_list = NULL; | ||
399 | mach->action_list = NULL; | ||
400 | mach->comp_list = NULL; | ||
401 | |||
402 | mach->progsize = in->progsize; | ||
403 | mach->prog = in->prog; | ||
404 | |||
405 | mach->pc = 0; | ||
406 | mach->reg = 0; | ||
407 | mach->stack = NULL; | ||
408 | |||
409 | mach->debug_level = in->debug_level; | ||
410 | |||
411 | mach->data = in->data; | ||
412 | mach->error_printer = in->error_printer; | ||
413 | mach->parse_error_printer = in->parse_error_printer; | ||
414 | mach->debug_printer = in->debug_printer; | ||
415 | mach->logger = in->logger; | ||
416 | mach->debug = in->debug; | ||
417 | mach->daemon_email = in->daemon_email; | ||
418 | |||
419 | *out = mach; | ||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | void | ||
371 | mu_sieve_set_error (mu_sieve_machine_t mach, mu_sieve_printf_t error_printer) | 424 | mu_sieve_set_error (mu_sieve_machine_t mach, mu_sieve_printf_t error_printer) |
372 | { | 425 | { |
373 | mach->error_printer = error_printer ? | 426 | mach->error_printer = error_printer ? |
... | @@ -463,7 +516,8 @@ struct sieve_destr_record | ... | @@ -463,7 +516,8 @@ struct sieve_destr_record |
463 | }; | 516 | }; |
464 | 517 | ||
465 | int | 518 | int |
466 | mu_sieve_machine_add_destructor (mu_sieve_machine_t mach, mu_sieve_destructor_t destr, | 519 | mu_sieve_machine_add_destructor (mu_sieve_machine_t mach, |
520 | mu_sieve_destructor_t destr, | ||
467 | void *ptr) | 521 | void *ptr) |
468 | { | 522 | { |
469 | struct sieve_destr_record *p; | 523 | struct sieve_destr_record *p; | ... | ... |
-
Please register or sign in to post a comment