?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* l_err.h - declarations for "l_err.c".
  2.  
  3.    This is free and unencumbered software released into the public domain.
  4.    For more information, please refer to <http://unlicense.org>. */
  5.  
  6. #ifndef _L_ERR_H_INCLUDED
  7. #define _L_ERR_H_INCLUDED
  8.  
  9. #include "defs.h"
  10.  
  11. #include <stdbool.h>
  12. #include <stdarg.h>
  13. #include "l_list.h"
  14.  
  15. // Errors list structure
  16.  
  17. // Entry
  18.  
  19. struct error_entry_t
  20. {
  21.     struct list_entry_t list_entry;
  22.     char *msg;
  23. };
  24.  
  25. void
  26.     error_entry_clear
  27.     (
  28.         struct error_entry_t *self
  29.     );
  30.  
  31. void
  32.     error_entry_free
  33.     (
  34.         struct error_entry_t *self
  35.     );
  36.  
  37. // List
  38.  
  39. struct errors_t
  40. {
  41.     struct list_t list;
  42. };
  43.  
  44. void
  45.     errors_clear
  46.     (
  47.         struct errors_t *self
  48.     );
  49.  
  50. // Returns "false" on success ("result" if presents is set to list entry).
  51. bool
  52.     errors_add
  53.     (
  54.         struct errors_t *self,
  55.         const char *msg,
  56.         struct error_entry_t **result
  57.     );
  58.  
  59. // Returns "false" on success ("result" if presents is set to list entry).
  60. bool
  61.     errors_add_vfmt
  62.     (
  63.         struct errors_t *self,
  64.         struct error_entry_t **result,
  65.         unsigned bufsize,
  66.         const char *format,
  67.         va_list ap
  68.     );
  69.  
  70. // Returns "false" on success ("result" if presents is set to list entry).
  71. bool
  72.     errors_add_fmt
  73.     (
  74.         struct errors_t *self,
  75.         struct error_entry_t **result,
  76.         unsigned bufsize,
  77.         const char *format,
  78.         ...
  79.     );
  80.  
  81. void
  82.     errors_free
  83.     (
  84.         struct errors_t *self
  85.     );
  86.  
  87. #endif  // !_L_ERR_H_INCLUDED
  88.