* [PATCH 1/5] cert: remove usused elem_data variable
@ 2024-03-05 13:28 James Prestwood
2024-03-05 13:28 ` [PATCH 2/5] dbus: remove unused 'type' variable James Prestwood
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-05 13:28 UTC (permalink / raw)
To: ell; +Cc: James Prestwood
This was being set in the if block, but never used after that.
Instead just check the return value directly.
---
ell/cert.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ell/cert.c b/ell/cert.c
index ead9cfd..38bb01a 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -1658,7 +1658,6 @@ static int cert_try_load_der_format(const uint8_t *content, size_t content_len,
{
const uint8_t *seq;
size_t seq_len;
- const uint8_t *elem_data;
size_t elem_len;
uint8_t tag;
@@ -1674,8 +1673,7 @@ static int cert_try_load_der_format(const uint8_t *content, size_t content_len,
* to add any more formats we'll probably need to start guessing
* from the filename suffix.
*/
- if (!(elem_data = asn1_der_find_elem(seq, seq_len,
- 0, &tag, &elem_len)))
+ if (!asn1_der_find_elem(seq, seq_len,0, &tag, &elem_len))
return -ENOMSG;
if (tag == ASN1_ID_SEQUENCE) {
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] dbus: remove unused 'type' variable
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
@ 2024-03-05 13:28 ` James Prestwood
2024-03-05 13:28 ` [PATCH 3/5] gvariant-util: remove unneeded initializer James Prestwood
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-05 13:28 UTC (permalink / raw)
To: ell; +Cc: James Prestwood
This was being set in the if block but never used afterwards.
---
ell/dbus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/ell/dbus.c b/ell/dbus.c
index 532e07b..d610532 100644
--- a/ell/dbus.c
+++ b/ell/dbus.c
@@ -1689,8 +1689,7 @@ LIB_EXPORT unsigned int l_dbus_add_signal_watch(struct l_dbus *dbus,
va_start(args, member);
rule_len = 0;
- while ((type = va_arg(args, enum l_dbus_match_type)) !=
- L_DBUS_MATCH_NONE)
+ while (va_arg(args, enum l_dbus_match_type) != L_DBUS_MATCH_NONE)
rule_len++;
va_end(args);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] gvariant-util: remove unneeded initializer
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
2024-03-05 13:28 ` [PATCH 2/5] dbus: remove unused 'type' variable James Prestwood
@ 2024-03-05 13:28 ` James Prestwood
2024-03-05 13:28 ` [PATCH 4/5] queue: remove unneeded entry advancement James Prestwood
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-05 13:28 UTC (permalink / raw)
To: ell; +Cc: James Prestwood
'i' is initialized inside the for loop, so remove this extra
initialization prior.
---
ell/gvariant-util.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ell/gvariant-util.c b/ell/gvariant-util.c
index 6a695d4..6482e24 100644
--- a/ell/gvariant-util.c
+++ b/ell/gvariant-util.c
@@ -843,7 +843,6 @@ static void container_append_struct_offsets(struct container *container,
offset_size = offset_length(builder->body_pos,
container->offset_index);
- i = container->offset_index - 1;
start = grow_body(builder, offset_size * container->offset_index, 1);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] queue: remove unneeded entry advancement
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
2024-03-05 13:28 ` [PATCH 2/5] dbus: remove unused 'type' variable James Prestwood
2024-03-05 13:28 ` [PATCH 3/5] gvariant-util: remove unneeded initializer James Prestwood
@ 2024-03-05 13:28 ` James Prestwood
2024-03-05 13:28 ` [PATCH 5/5] unit: assert return of several gvariant-util calls James Prestwood
2024-03-12 3:12 ` [PATCH 1/5] cert: remove usused elem_data variable Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-05 13:28 UTC (permalink / raw)
To: ell; +Cc: James Prestwood
At this point the loop is over and there is no point advancing
the entry pointer.
---
ell/queue.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/ell/queue.c b/ell/queue.c
index 487a949..9018402 100644
--- a/ell/queue.c
+++ b/ell/queue.c
@@ -511,8 +511,6 @@ LIB_EXPORT void *l_queue_remove_if(struct l_queue *queue,
if (!entry->next)
queue->tail = prev;
- entry = entry->next;
-
data = tmp->data;
l_free(tmp);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] unit: assert return of several gvariant-util calls
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
` (2 preceding siblings ...)
2024-03-05 13:28 ` [PATCH 4/5] queue: remove unneeded entry advancement James Prestwood
@ 2024-03-05 13:28 ` James Prestwood
2024-03-12 3:12 ` [PATCH 1/5] cert: remove usused elem_data variable Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-05 13:28 UTC (permalink / raw)
To: ell; +Cc: James Prestwood
Caught by clang static analysis, there were several calls where the
return value was unused.
---
unit/test-gvariant-util.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/unit/test-gvariant-util.c b/unit/test-gvariant-util.c
index 7b2e860..9a7a5df 100644
--- a/unit/test-gvariant-util.c
+++ b/unit/test-gvariant-util.c
@@ -644,6 +644,7 @@ static void test_iter_variant_2(const void *test_data)
assert(ret);
ret = _gvariant_iter_enter_struct(&variant, &structure);
+ assert(ret);
ret = _gvariant_iter_next_entry_basic(&structure, 's', &s);
assert(ret);
@@ -1047,6 +1048,7 @@ static void test_iter_header_1(const void *test_data)
ret = _gvariant_iter_init(&iter, NULL, "a(yv)", NULL,
test->data + 16, u);
+ assert(ret);
ret = _gvariant_iter_enter_array(&iter, &array);
assert(ret);
@@ -1308,6 +1310,7 @@ static void test_builder_fixed_struct_2(const void *test_data)
assert(ret);
ret = _gvariant_builder_append_basic(builder, 't', &t);
+ assert(ret);
ret = _gvariant_builder_leave_struct(builder);
assert(ret);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/5] cert: remove usused elem_data variable
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
` (3 preceding siblings ...)
2024-03-05 13:28 ` [PATCH 5/5] unit: assert return of several gvariant-util calls James Prestwood
@ 2024-03-12 3:12 ` Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2024-03-12 3:12 UTC (permalink / raw)
To: James Prestwood, ell
Hi James,
On 3/5/24 07:28, James Prestwood wrote:
> This was being set in the if block, but never used after that.
> Instead just check the return value directly.
> ---
> ell/cert.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
All applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-12 3:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 13:28 [PATCH 1/5] cert: remove usused elem_data variable James Prestwood
2024-03-05 13:28 ` [PATCH 2/5] dbus: remove unused 'type' variable James Prestwood
2024-03-05 13:28 ` [PATCH 3/5] gvariant-util: remove unneeded initializer James Prestwood
2024-03-05 13:28 ` [PATCH 4/5] queue: remove unneeded entry advancement James Prestwood
2024-03-05 13:28 ` [PATCH 5/5] unit: assert return of several gvariant-util calls James Prestwood
2024-03-12 3:12 ` [PATCH 1/5] cert: remove usused elem_data variable Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox