Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generate_multiple.template with Dynamic memory allocation to a… #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions templates/generate_multiple.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
void output_STRUCT_NAME_stat_mode(std::ostream& response, const std::string& static_labels, const std::string& name, const std::string& type, const std::string& help, perfstat_STRUCT_NAME_t STRUCT_NAMEs[], size_t STRUCT_NAME_count, const std::function<double (perfstat_STRUCT_NAME_t&)>& func) {
void output_STRUCT_NAME_stat_mode(std::ostream& response, const std::string& static_labels, const std::string& name, const std::string& type, const std::string& help, perfstat_STRUCT_NAME_t *STRUCT_NAMEs, size_t STRUCT_NAME_count, const std::function<double (perfstat_STRUCT_NAME_t&)>& func) {
response << "# HELP " << name << " " << help << std::endl;
response << "# TYPE " << name << " " << type << std::endl;

Expand All @@ -10,9 +10,10 @@ void output_STRUCT_NAME_stat_mode(std::ostream& response, const std::string& sta
}

void gather_STRUCT_NAMEs(std::ostream& response, const std::string& static_labels) {
perfstat_STRUCT_NAME_t *STRUCT_NAMEs;
int STRUCT_NAME_count = perfstat_STRUCT_NAME(NULL, NULL, sizeof(perfstat_STRUCT_NAME_t), 0);

perfstat_STRUCT_NAME_t STRUCT_NAMEs[STRUCT_NAME_count];
STRUCT_NAMEs = (perfstat_STRUCT_NAME_t*)calloc(STRUCT_NAME_count, sizeof(perfstat_STRUCT_NAME_t));
//perfstat_STRUCT_NAME_t STRUCT_NAMEs[STRUCT_NAME_count];
perfstat_ID_STRUCT_t firstSTRUCT_NAME;

INITIALIZER;
Expand Down