/[pdpsoft]/trunk/grid-mw-security/ees/src/eval_man/pdl.c
ViewVC logotype

Diff of /trunk/grid-mw-security/ees/src/eval_man/pdl.c

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

revision 1068 by aramv, Sun Oct 11 14:00:29 2009 UTC revision 1069 by aramv, Mon Nov 9 13:34:12 2009 UTC
# Line 1  Line 1 
1  #include "pdl.h"  #include "pdl.h"
2    
3  /* Lex/Yacc stuff */  /* Lex/Yacc stuff */
4  extern FILE *        yyin;  extern FILE *               yyin;
5  extern int           yylex_destroy(void);  extern int                  yylex_destroy(void);
6  extern int           yyparse(void);  extern int                  yyparse(void);
7  extern int           yylex(void);  extern int                  yylex(void);
8  static char*         _pdl_path;  extern int                  yy_delete_buffer(YY_BUFFER_STATE);
9  FILE*                config_file;  extern void                 delete_lex_buffer(void);
10  static var_t*        plugin_list;  
11  static var_t*        plugin_list_last;  /* internal data */
12  static var_t*        current_plugin;  static char*                _pdl_path;
13    FILE*                       config_file;
14  /* globals */  static var_t*               plugin_list;
15  EES_RC               config_file_ok;  static var_t*               plugin_list_last;
16    static var_t*               current_plugin;
17    EES_RC                      config_file_ok;
18    
19  EES_RC pdl_init(const char* name){  EES_RC pdl_init(const char* name){
20    if((config_file = fopen(name,"r")) != NULL){    if((config_file = fopen(name,"r")) != NULL){
# Line 110  const char* get_pdl_path(){ Line 112  const char* get_pdl_path(){
112    return _pdl_path;    return _pdl_path;
113  }  }
114    
115  rule_t* add_rule(record_t* state, record_t* true_branch, record_t* false_branch){  rule_t* add_rule(record_t* rule, record_t* true_branch, record_t* false_branch){
116    rule_t* new_rule = malloc(sizeof(rule_t));    rule_t* new_rule = malloc(sizeof(rule_t));
117    if(state != NULL){    if(rule != NULL){
118      eef_log(LOG_DEBUG, "Added a new rule: %s\n", state->string);      eef_log(LOG_DEBUG, "Added a new rule: %s\n", rule->string);
119    }    }
120    if(true_branch != NULL){    if(true_branch != NULL){
121      eef_log(LOG_DEBUG, "True branch: %s\n", true_branch->string);      eef_log(LOG_DEBUG, "True branch: %s\n", true_branch->string);
# Line 121  rule_t* add_rule(record_t* state, record Line 123  rule_t* add_rule(record_t* state, record
123    if(false_branch != NULL){    if(false_branch != NULL){
124      eef_log(LOG_DEBUG, "False branch: %s\n", false_branch->string);      eef_log(LOG_DEBUG, "False branch: %s\n", false_branch->string);
125    }    }
126    if(state != NULL){    if(rule != NULL){
127      free(state->string);      free(rule->string);
128    }    }
129    free(state);    free(rule);
130    if(true_branch != NULL){    if(true_branch != NULL){
131      free(true_branch->string);      free(true_branch->string);
132    }    }
# Line 233  EES_RC pdl_term(){ Line 235  EES_RC pdl_term(){
235    free(_pdl_path);    free(_pdl_path);
236    clean_variables();    clean_variables();
237    if(config_file != NULL){    if(config_file != NULL){
238        /* This is the preferred way of cleaning up various flex versions - See: http://flex.sourceforge.net/manual/Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e.html#Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e */
239      #if HAVE_YYLEX_DESTROY      #if HAVE_YYLEX_DESTROY
240        yylex_destroy();        yylex_destroy();
241        #else
242          eef_log(LOG_WARNING, "Lex function yylex_destroy() not available - possibly unable to free allocated memory for evaluation manager\n");
243          #if HAVE_FLEX
244            delete_lex_buffer();
245          #endif
246      #endif      #endif
247      if((fclose(config_file)==0) ){      if((fclose(config_file)==0) ){
248        return EES_SUCCESS;        return EES_SUCCESS;

Legend:
Removed from v.1068  
changed lines
  Added in v.1069

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28