All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-ust] Code cleanup in contexts
@ 2019-03-14 16:31 Michael Jeanson
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Jeanson @ 2019-03-14 16:31 UTC (permalink / raw)
  To: lttng-dev

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 liblttng-ust/lttng-context-cpu-id.c        |  5 +----
 liblttng-ust/lttng-context-perf-counters.c |  5 +----
 liblttng-ust/lttng-context-procname.c      | 10 ++--------
 liblttng-ust/lttng-context-pthread-id.c    |  5 +----
 4 files changed, 5 insertions(+), 20 deletions(-)

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)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH lttng-ust] Code cleanup in contexts
       [not found] <20190314163135.24046-1-mjeanson@efficios.com>
@ 2019-03-14 16:36 ` Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2019-03-14 16:36 UTC (permalink / raw)
  To: Michael Jeanson; +Cc: lttng-dev

Merged into master, thanks!

Mathieu

----- On Mar 14, 2019, at 12:31 PM, Michael Jeanson mjeanson@efficios.com wrote:

> Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> ---
> liblttng-ust/lttng-context-cpu-id.c        |  5 +----
> liblttng-ust/lttng-context-perf-counters.c |  5 +----
> liblttng-ust/lttng-context-procname.c      | 10 ++--------
> liblttng-ust/lttng-context-pthread-id.c    |  5 +----
> 4 files changed, 5 insertions(+), 20 deletions(-)
> 
> 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)
> --
> 2.17.1

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-14 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 16:31 [PATCH lttng-ust] Code cleanup in contexts Michael Jeanson
     [not found] <20190314163135.24046-1-mjeanson@efficios.com>
2019-03-14 16:36 ` Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.