From: Michael Jeanson Date: Thu, 14 Mar 2019 16:31:35 +0000 (-0400) Subject: Code cleanup in contexts X-Git-Tag: v2.12.0-rc1~51 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6e9ac4ae894690c95df4566289422c4c05ab472a;p=lttng-ust.git Code cleanup in contexts Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-context-cpu-id.c b/liblttng-ust/lttng-context-cpu-id.c index 7cbf3cea..a3252f15 100644 --- a/liblttng-ust/lttng-context-cpu-id.c +++ b/liblttng-ust/lttng-context-cpu-id.c @@ -61,10 +61,7 @@ static void cpu_id_get_value(struct lttng_ctx_field *field, struct lttng_ctx_value *value) { - int cpu; - - cpu = lttng_ust_get_cpu(); - value->u.s64 = cpu; + value->u.s64 = lttng_ust_get_cpu(); } int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx) diff --git a/liblttng-ust/lttng-context-perf-counters.c b/liblttng-ust/lttng-context-perf-counters.c index a15417cc..4816f89b 100644 --- a/liblttng-ust/lttng-context-perf-counters.c +++ b/liblttng-ust/lttng-context-perf-counters.c @@ -367,10 +367,7 @@ static void perf_counter_get_value(struct lttng_ctx_field *field, struct lttng_ctx_value *value) { - uint64_t v; - - v = wrapper_perf_counter_read(field); - value->u.s64 = v; + value->u.s64 = wrapper_perf_counter_read(field); } /* Called with UST lock held */ diff --git a/liblttng-ust/lttng-context-procname.c b/liblttng-ust/lttng-context-procname.c index 8c1520ad..c6d02cf6 100644 --- a/liblttng-ust/lttng-context-procname.c +++ b/liblttng-ust/lttng-context-procname.c @@ -78,10 +78,7 @@ void lttng_context_procname_reset(void) static size_t procname_get_size(struct lttng_ctx_field *field, size_t offset) { - size_t size = 0; - - size += LTTNG_UST_PROCNAME_LEN; - return size; + return LTTNG_UST_PROCNAME_LEN; } static @@ -99,10 +96,7 @@ static void procname_get_value(struct lttng_ctx_field *field, struct lttng_ctx_value *value) { - char *procname; - - procname = wrapper_getprocname(); - value->u.str = procname; + value->u.str = wrapper_getprocname(); } int lttng_add_procname_to_ctx(struct lttng_ctx **ctx) diff --git a/liblttng-ust/lttng-context-pthread-id.c b/liblttng-ust/lttng-context-pthread-id.c index 552100de..5f9faf85 100644 --- a/liblttng-ust/lttng-context-pthread-id.c +++ b/liblttng-ust/lttng-context-pthread-id.c @@ -52,10 +52,7 @@ static void pthread_id_get_value(struct lttng_ctx_field *field, struct lttng_ctx_value *value) { - unsigned long pthread_id; - - pthread_id = (unsigned long) pthread_self(); - value->u.s64 = pthread_id; + value->u.s64 = (unsigned long) pthread_self(); } int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx)