/[mailutils]/mailutils/libsieve/sieve.y
ViewVC logotype

Diff of /mailutils/libsieve/sieve.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by gray, Thu Nov 14 14:49:54 2002 UTC revision 1.7 by gray, Fri Nov 15 14:43:03 2002 UTC
# Line 349  sieve_machine_init (sieve_machine_t *pma Line 349  sieve_machine_init (sieve_machine_t *pma
349    if (rc)    if (rc)
350      {      {
351        free (mach);        free (mach);
352        return NULL;        return 1;
353      }      }
354    list_append (mach->memory_pool, mach);    list_append (mach->memory_pool, mach);
355        
# Line 404  sieve_get_ticket (sieve_machine_t mach) Line 404  sieve_get_ticket (sieve_machine_t mach)
404    return mach->ticket;    return mach->ticket;
405  }  }
406    
407    struct sieve_destr_record
408    {
409      sieve_destructor_t destr;
410      void *ptr;
411    };
412    
413    int
414    sieve_machine_add_destructor (sieve_machine_t mach, sieve_destructor_t destr,
415                                  void *ptr)
416    {
417      struct sieve_destr_record *p;
418      
419      if (!mach->destr_list && list_create (&mach->destr_list))
420        return 1;
421      p = sieve_palloc (&mach->memory_pool, sizeof (*p));
422      if (!p)
423        return 1;
424      p->destr = destr;
425      p->ptr = ptr;
426      return list_append (mach->memory_pool, p);
427    }
428    
429    static int
430    _run_destructor (void *data, void *unused)
431    {
432      struct sieve_destr_record *p = data;
433      p->destr (p->ptr);
434      return 0;
435    }
436    
437    void
438    sieve_machine_destroy (sieve_machine_t *pmach)
439    {
440      sieve_machine_t mach = *pmach;
441      list_do (mach->destr_list, _run_destructor, NULL);
442      list_destroy (&mach->destr_list);
443      sieve_slist_destroy (&mach->memory_pool);
444      free (mach);
445      *pmach = NULL;
446    }
447    
448  /* FIXME: When posix thread support is added, sieve_machine_begin() should  /* FIXME: When posix thread support is added, sieve_machine_begin() should
449     acquire the global mutex, locking the current compilation session, and     acquire the global mutex, locking the current compilation session, and
450     sieve_machine_finish() should release it */     sieve_machine_finish() should release it */

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26