Skip to content

Commit

Permalink
Use cf_calloc to initialize as_metrics_writer struct. Ignore certain …
Browse files Browse the repository at this point in the history
…Visual Studio warning messages.
  • Loading branch information
BrianNichols committed Feb 16, 2024
1 parent b274d28 commit c85ba8f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/main/aerospike/as_metrics_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,22 +593,16 @@ as_metrics_writer_create(as_error* err, const as_metrics_policy* policy, as_metr
"Metrics policy report_size_limit %" PRIu64 " must be at least %d", policy->report_size_limit, MIN_FILE_SIZE);
}

as_metrics_writer* mw = cf_malloc(sizeof(as_metrics_writer));
as_metrics_writer* mw = cf_calloc(1, sizeof(as_metrics_writer));
as_strncpy(mw->report_dir, policy->report_dir, sizeof(mw->report_dir));
mw->file = NULL;
mw->max_size = policy->report_size_limit;
mw->size = 0;
mw->latency_columns = policy->latency_columns;
mw->latency_shift = policy->latency_shift;
mw->enable = false;

#ifdef _MSC_VER
mw->pid = GetCurrentProcessId();
mw->process = OpenProcess(PROCESS_QUERY_INFORMATION, false, mw->pid);
mw->prev_process_times_kernel = 0;
mw->prev_process_times_user = 0;
mw->prev_system_times_kernel = 0;
mw->prev_system_times_user = 0;

FILETIME dummy;
if (mw->process != NULL)
Expand Down
2 changes: 2 additions & 0 deletions vs/aerospike/aerospike.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
<ClInclude Include="..\..\src\include\aerospike\as_lookup.h" />
<ClInclude Include="..\..\src\include\aerospike\as_map_operations.h" />
<ClInclude Include="..\..\src\include\aerospike\as_metrics.h" />
<ClInclude Include="..\..\src\include\aerospike\as_metrics_writer.h" />
<ClInclude Include="..\..\src\include\aerospike\as_node.h" />
<ClInclude Include="..\..\src\include\aerospike\as_operations.h" />
<ClInclude Include="..\..\src\include\aerospike\as_partition.h" />
Expand Down Expand Up @@ -551,6 +552,7 @@
<ClCompile Include="..\..\src\main\aerospike\as_lookup.c" />
<ClCompile Include="..\..\src\main\aerospike\as_map_operations.c" />
<ClCompile Include="..\..\src\main\aerospike\as_metrics.c" />
<ClCompile Include="..\..\src\main\aerospike\as_metrics_writer.c" />
<ClCompile Include="..\..\src\main\aerospike\as_node.c" />
<ClCompile Include="..\..\src\main\aerospike\as_operations.c" />
<ClCompile Include="..\..\src\main\aerospike\as_partition.c" />
Expand Down
6 changes: 6 additions & 0 deletions vs/aerospike/aerospike.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@
<ClInclude Include="..\..\src\include\aerospike\as_metrics.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\include\aerospike\as_metrics_writer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\main\aerospike\_bin.c">
Expand Down Expand Up @@ -947,6 +950,9 @@
<ClCompile Include="..\..\src\main\aerospike\as_metrics.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\main\aerospike\as_metrics_writer.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
2 changes: 1 addition & 1 deletion vs/props/base.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_TIMESPEC_DEFINED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4098;4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4098;4996;6255;6262;26451</DisableSpecificWarnings>
</ClCompile>
<Link>
</Link>
Expand Down

0 comments on commit c85ba8f

Please sign in to comment.