projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clang-tidy: add Chrome-inspired checks
[lttng-tools.git]
/
src
/
common
/
context.cpp
diff --git
a/src/common/context.cpp
b/src/common/context.cpp
index 98c29f86c2cbac21f344e3a1df33231e6e6eb7c5..60e30ad298d9edc9a9bf7a519dc0bba32cf794d3 100644
(file)
--- a/
src/common/context.cpp
+++ b/
src/common/context.cpp
@@
-6,16
+6,17
@@
*/
#include "context.hpp"
*/
#include "context.hpp"
-#include <stddef.h>
-#include <string.h>
+
#include <common/error.hpp>
#include <common/macros.hpp>
#include <common/error.hpp>
#include <common/macros.hpp>
-int parse_application_context(const char *str, char **out_provider_name,
- char **out_ctx_name)
+#include <stddef.h>
+#include <string.h>
+
+int parse_application_context(const char *str, char **out_provider_name, char **out_ctx_name)
{
const char app_ctx_prefix[] = "$app.";
{
const char app_ctx_prefix[] = "$app.";
- char *provider_name =
NULL, *ctx_name = NULL
;
+ char *provider_name =
nullptr, *ctx_name = nullptr
;
size_t i, len, colon_pos = 0, provider_name_len, ctx_name_len;
if (!str || !out_provider_name || !out_ctx_name) {
size_t i, len, colon_pos = 0, provider_name_len, ctx_name_len;
if (!str || !out_provider_name || !out_ctx_name) {
@@
-46,22
+47,20
@@
int parse_application_context(const char *str, char **out_provider_name,
* No colon found or no ctx name ("$app.provider:") or no provider name
* given ("$app.:..."), which is invalid.
*/
* No colon found or no ctx name ("$app.provider:") or no provider name
* given ("$app.:..."), which is invalid.
*/
- if (!colon_pos || colon_pos == len ||
- colon_pos == sizeof(app_ctx_prefix)) {
+ if (!colon_pos || colon_pos == len || colon_pos == sizeof(app_ctx_prefix)) {
goto not_found;
}
provider_name_len = colon_pos - sizeof(app_ctx_prefix) + 2;
goto not_found;
}
provider_name_len = colon_pos - sizeof(app_ctx_prefix) + 2;
- provider_name =
(char *) zmalloc
(provider_name_len);
+ provider_name =
calloc<char>
(provider_name_len);
if (!provider_name) {
PERROR("malloc provider_name");
goto not_found;
}
if (!provider_name) {
PERROR("malloc provider_name");
goto not_found;
}
- strncpy(provider_name, str + sizeof(app_ctx_prefix) - 1,
- provider_name_len - 1);
+ strncpy(provider_name, str + sizeof(app_ctx_prefix) - 1, provider_name_len - 1);
ctx_name_len = len - colon_pos;
ctx_name_len = len - colon_pos;
- ctx_name =
(char *) zmalloc
(ctx_name_len);
+ ctx_name =
calloc<char>
(ctx_name_len);
if (!ctx_name) {
PERROR("malloc ctx_name");
goto not_found;
if (!ctx_name) {
PERROR("malloc ctx_name");
goto not_found;
@@
-76,4
+75,3
@@
not_found:
free(ctx_name);
return -1;
}
free(ctx_name);
return -1;
}
-
This page took
0.025692 seconds
and
4
git commands to generate.