sieve: redo symbol registry support.
The purpose is to simplify the machine structure and to ensure its clones are completely independent of the master instance. * include/mailutils/sieve.h (mu_sieve_command): New struct. (mu_sieve_record): New enum (mu_sieve_registry_t): Generalize for storing various types of objects. (mu_sieve_test_lookup,mu_sieve_action_lookup) (mu_sieve_require_action,mu_sieve_require_test) (mu_sieve_require_comparator): Remove. (mu_sieve_register_test_ext,mu_sieve_register_test) (mu_sieve_register_action_ext,mu_sieve_register_action) (mu_sieve_register_comparator) (mu_sieve_load_ext): Change return type. (mu_sieve_registry_require,mu_sieve_unload_ext): New functions. (mu_sieve_machine_inherit): Rename to mu_sieve_machine_clone. * libmu_sieve/sieve-priv.h (mu_sieve_machine): Remove source_list, test_list, action_list, and comp_list. Add a single registry list instead. Add space for file and command (action and test) names: idspace, idcount, idmax. Remove unused field "stack"; (mu_i_sv_lex_finish): Change prototype. (_mu_i_sv_instr_push,_mu_i_sv_instr_pop): Remove protos. (mu_i_sv_id_canon,mu_i_sv_id_num) (mu_i_sv_id_str,mu_i_sv_free_idspace): New protos. * libmu_sieve/register.c: Rename to registry.c * libmu_sieve/registry.c (mu_sieve_test_lookup) (mu_sieve_action_lookup): Remove. (mu_sieve_require_test,mu_sieve_require_action): Remove. (mu_sieve_registry_require): New function. (mu_sieve_registry_add,mu_sieve_registry_lookup): New functions. * libmu_sieve/Makefile.am: Update. * libmu_sieve/comparator.c: Rewrite using new registry functions. * libmu_sieve/load.c (mu_sieve_load_ext): Return module handle. (mu_sieve_unload_ext): New function. * libmu_sieve/mem.c (mu_sieve_free): Gracefully handle NULL argument. (mu_i_sv_id_canon,mu_i_sv_id_num,mu_i_sv_id_str): New functions. * libmu_sieve/prog.c (mu_i_sv_locus): Store index of the file name in the id space, instead of pointer to the name itself. * libmu_sieve/require.c (mu_sieve_require): Rewrite. * libmu_sieve/runtime.c (_mu_i_sv_instr_source): Expect ID index as argument. (_mu_i_sv_instr_push) (_mu_i_sv_instr_pop): Remove unused instructions. * libmu_sieve/sieve.l (file_names): Remove. Use mu_sieve_machine idspace instead. * libmu_sieve/sieve.y (mu_sieve_machine_clone) (mu_sieve_machine_dup): Rewrite. (mu_sieve_machine_destroy): Free idspace and registry * examples/numaddr.c: Reflect changes. * libmu_sieve/extensions/editheader.c: Likewise. * libmu_sieve/extensions/list.c: Likewise. * libmu_sieve/extensions/moderator.c: Likewise. * libmu_sieve/extensions/pipe.c: Likewise. * libmu_sieve/extensions/spamd.c: Likewise. * libmu_sieve/extensions/timestamp.c: Likewise. * libmu_sieve/extensions/vacation.c: Likewise.
Showing
21 changed files
with
404 additions
and
363 deletions
-
Please register or sign in to post a comment