From 224a42e1f04fdcadbb4c2bf4261630eef19a74fb Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 23 Feb 2023 10:21:10 -0700 Subject: [PATCH] bifcl: Use nullptrs for pointer initializations --- tools/bifcl/builtin-func.l | 26 +++++++++++++------------- tools/bifcl/builtin-func.y | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/bifcl/builtin-func.l b/tools/bifcl/builtin-func.l index fe6b028317..5b98f054d4 100644 --- a/tools/bifcl/builtin-func.l +++ b/tools/bifcl/builtin-func.l @@ -153,19 +153,19 @@ int yywrap() } extern int yyparse(); -char* input_filename = 0; -char* input_filename_with_path = 0; -char* plugin = 0; +char* input_filename = nullptr; +char* input_filename_with_path = nullptr; +char* plugin = nullptr; int alternative_mode = 0; -FILE* fp_zeek_init = 0; -FILE* fp_func_def = 0; -FILE* fp_func_h = 0; -FILE* fp_func_init = 0; -FILE* fp_func_register = 0; -FILE* fp_netvar_h = 0; -FILE* fp_netvar_def = 0; -FILE* fp_netvar_init = 0; +FILE* fp_zeek_init = nullptr; +FILE* fp_func_def = nullptr; +FILE* fp_func_h = nullptr; +FILE* fp_func_init = nullptr; +FILE* fp_func_register = nullptr; +FILE* fp_netvar_h = nullptr; +FILE* fp_netvar_def = nullptr; +FILE* fp_netvar_init = nullptr; void remove_file(const char *surfix); void err_exit(void); @@ -201,7 +201,7 @@ void init_alternative_mode() fp_func_h = open_output_file("h"); fp_func_def = open_output_file("cc"); fp_func_init = open_output_file("init.cc"); - fp_func_register = plugin ? open_output_file("register.cc") : NULL; + fp_func_register = plugin ? open_output_file("register.cc") : nullptr; fp_netvar_h = fp_func_h; fp_netvar_def = fp_func_def; @@ -425,7 +425,7 @@ void close_if_open(FILE **fpp) { if (*fpp) fclose(*fpp); - *fpp = NULL; + *fpp = nullptr; } void close_all_output_files(void) diff --git a/tools/bifcl/builtin-func.y b/tools/bifcl/builtin-func.y index d4fb2d968e..2188eb3293 100644 --- a/tools/bifcl/builtin-func.y +++ b/tools/bifcl/builtin-func.y @@ -246,7 +246,7 @@ static void print_event_c_body(FILE* fp) fprintf(fp, "\t// allocation.\n"); fprintf(fp, "\n"); - BuiltinFuncArg* connection_arg = 0; + BuiltinFuncArg* connection_arg = nullptr; fprintf(fp, "\tzeek::event_mgr.Enqueue(%s, zeek::Args{\n", decl.c_fullname.c_str()); @@ -258,7 +258,7 @@ static void print_event_c_body(FILE* fp) if ( args[i]->Type() == TYPE_CONNECTION ) { - if ( connection_arg == 0 ) + if ( connection_arg == nullptr ) connection_arg = args[i]; else { @@ -567,7 +567,7 @@ plain_head: head_1 args arg_end opt_ws head_1: TOK_ID opt_ws arg_begin { - const char* method_type = 0; + const char* method_type = nullptr; set_decl_name($1); if ( definition_type == FUNC_DEF )