/[LeafOK_CVS]/lbbs/src/bwf.c
ViewVC logotype

Diff of /lbbs/src/bwf.c

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

Revision 1.4 by sysadm, Fri Nov 7 09:18:58 2025 UTC Revision 1.6 by sysadm, Fri Nov 21 10:34:10 2025 UTC
# Line 6  Line 6 
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9    #ifdef HAVE_CONFIG_H
10    #include "config.h"
11    #endif
12    
13  #define PCRE2_CODE_UNIT_WIDTH 8  #define PCRE2_CODE_UNIT_WIDTH 8
14    
15  #include "bwf.h"  #include "bwf.h"
# Line 31  int bwf_load(const char *filename) Line 35  int bwf_load(const char *filename)
35          size_t len_line;          size_t len_line;
36          char *p = bwf_pattern_str;          char *p = bwf_pattern_str;
37          int line_id = 0;          int line_id = 0;
         int errorcode;  
         PCRE2_SIZE erroroffset;  
38    
39          if (filename == NULL)          if (filename == NULL)
40          {          {
# Line 93  int bwf_load(const char *filename) Line 95  int bwf_load(const char *filename)
95          log_error("Debug: bwf_pattern_str: %s\n", bwf_pattern_str);          log_error("Debug: bwf_pattern_str: %s\n", bwf_pattern_str);
96  #endif  #endif
97    
98          bwf_unload();          return 0;
99    }
100    
101    int bwf_compile(void)
102    {
103            int errorcode;
104            PCRE2_SIZE erroroffset;
105    
106            bwf_cleanup();
107    
108          bwf_code = pcre2_compile((PCRE2_SPTR)bwf_pattern_str, PCRE2_ZERO_TERMINATED, PCRE2_CASELESS, &errorcode, &erroroffset, NULL);          bwf_code = pcre2_compile((PCRE2_SPTR)bwf_pattern_str, PCRE2_ZERO_TERMINATED, PCRE2_CASELESS, &errorcode, &erroroffset, NULL);
109          if (bwf_code == NULL)          if (bwf_code == NULL)
110          {          {
111                  log_error("pcre2_compile() error: %d", errorcode);                  log_error("pcre2_compile() error: %d", errorcode);
112                  return -4;                  return -1;
113          }          }
114    
115          return 0;          return 0;
116  }  }
117    
118  void bwf_unload(void)  void bwf_cleanup(void)
119  {  {
120          if (bwf_code != NULL)          if (bwf_code != NULL)
121          {          {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1