From 12a3b4e002b34ba115959b89f113e76a325e5389 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Tue, 20 Nov 2007 02:05:29 +0000 Subject: [PATCH] Do not generate constants php files from Thrift when they will be empty Summary: That's just silly Reviewed By: peter, dreiss Test Plan: Generate PHP from a .thrift with no constants. Notice there is no _constants.php generated. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665355 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_php_generator.cc | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc index 8a3bdb7c..9cf98aec 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -23,8 +23,6 @@ void t_php_generator::init_generator() { // Make output file string f_types_name = get_out_dir()+program_name_+"_types.php"; f_types_.open(f_types_name.c_str()); - string f_consts_name = get_out_dir()+program_name_+"_constants.php"; - f_consts_.open(f_consts_name.c_str()); // Print header f_types_ << @@ -42,13 +40,17 @@ void t_php_generator::init_generator() { f_types_ << endl; // Print header - f_consts_ << - "get_consts().empty()) { + string f_consts_name = get_out_dir()+program_name_+"_constants.php"; + f_consts_.open(f_consts_name.c_str()); + f_consts_ << + "" << endl; f_types_.close(); - f_consts_ << "?>" << endl; - f_consts_.close(); + if (!program_->get_consts().empty()) { + f_consts_ << "?>" << endl; + f_consts_.close(); + } } /** -- 2.17.1