Code cleanup in contexts
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 14 Mar 2019 16:31:35 +0000 (12:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 14 Mar 2019 16:35:58 +0000 (12:35 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-context-cpu-id.c
liblttng-ust/lttng-context-perf-counters.c
liblttng-ust/lttng-context-procname.c
liblttng-ust/lttng-context-pthread-id.c

index 7cbf3cea46a1a39857c12a1e4c3278d15e38bd69..a3252f1575369d99ca01049be48e171917ead6c3 100644 (file)
@@ -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)
index a15417ccde010435103ad5e0ef8621902fc6121b..4816f89b5a4a536e4cc2741e6e5d658379692baf 100644 (file)
@@ -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 */
index 8c1520ad51f221b467dd38815cd66868a75b137d..c6d02cf60d3b0692dd449e5f12f08a32b08307bf 100644 (file)
@@ -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)
index 552100decb4481c564ac912d98d0fead0292de2f..5f9faf8508923858343fc9c588df7b32ab87644f 100644 (file)
@@ -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)
This page took 0.026683 seconds and 4 git commands to generate.