* [PATCH] Don't compare a non-existing function with NULL
@ 2009-08-17 14:19 Daniel Mierswa
2009-08-17 21:06 ` Alan Jenkins
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Mierswa @ 2009-08-17 14:19 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
Obviously someone forgot something here or didn't use -ansi. Either way,
index is nowhere declared so I assume the current behaviour is to check
against the index() function coming from somewhere in the POSIX headers.
The comparison doesn't make sense then.
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
libudev/libudev-queue-private.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
[-- Attachment #2: 0001-Don-t-compare-a-non-existing-function-with-NULL.patch --]
[-- Type: text/x-patch, Size: 517 bytes --]
diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c
index 0427b65..c8e0150 100644
--- a/libudev/libudev-queue-private.c
+++ b/libudev/libudev-queue-private.c
@@ -158,8 +158,6 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e
return NULL;
}
devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long));
- if (index == NULL)
- return NULL;
devpaths->devpaths_size = range + 1;
/* read all records and populate the table */
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Don't compare a non-existing function with NULL
2009-08-17 14:19 [PATCH] Don't compare a non-existing function with NULL Daniel Mierswa
@ 2009-08-17 21:06 ` Alan Jenkins
2009-08-17 21:13 ` Daniel Mierswa
2009-08-18 0:01 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Alan Jenkins @ 2009-08-17 21:06 UTC (permalink / raw)
To: linux-hotplug
On 8/17/09, Daniel Mierswa <impulze@impulze.org> wrote:
>
> Obviously someone forgot something here or didn't use -ansi.
Guilty as charged.
> Either way,
> index is nowhere declared so I assume the current behaviour is to check
> against the index() function coming from somewhere in the POSIX headers.
> The comparison doesn't make sense then.
devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) *
sizeof(long));
- if (index = NULL)
- return NULL;
devpaths->devpaths_size = range + 1;
nak. The intention would have been to catch an "out of memory error"
when allocating devpaths. It should make sense if you replace "index"
with "devpaths" on that line instead,
Thanks for spotting this
Alan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Don't compare a non-existing function with NULL
2009-08-17 14:19 [PATCH] Don't compare a non-existing function with NULL Daniel Mierswa
2009-08-17 21:06 ` Alan Jenkins
@ 2009-08-17 21:13 ` Daniel Mierswa
2009-08-18 0:01 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Mierswa @ 2009-08-17 21:13 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 231 bytes --]
Alan Jenkins wrote:
> nak. The intention would have been to catch an "out of memory error"
> when allocating devpaths. It should make sense if you replace "index"
> with "devpaths" on that line instead,
done
New patch attached.
[-- Attachment #2: 0001-Don-t-compare-a-non-existing-function-with-NULL.patch --]
[-- Type: text/plain, Size: 1130 bytes --]
From 52311df17535588c767e64be55116c8f5f14c473 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Mon, 17 Aug 2009 14:59:26 +0200
Subject: [PATCH] Don't compare a non-existing function with NULL
Obviously someone forgot something here or didn't use -ansi. Either way,
index is nowhere declared so I assume the current behaviour is to check
against the index() function coming from somewhere in the POSIX headers.
The comparison doesn't make sense then.
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
libudev/libudev-queue-private.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c
index 0427b65..4dea4ad 100644
--- a/libudev/libudev-queue-private.c
+++ b/libudev/libudev-queue-private.c
@@ -158,7 +158,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e
return NULL;
}
devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long));
- if (index == NULL)
+ if (devpaths == NULL)
return NULL;
devpaths->devpaths_size = range + 1;
--
1.6.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Don't compare a non-existing function with NULL
2009-08-17 14:19 [PATCH] Don't compare a non-existing function with NULL Daniel Mierswa
2009-08-17 21:06 ` Alan Jenkins
2009-08-17 21:13 ` Daniel Mierswa
@ 2009-08-18 0:01 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2009-08-18 0:01 UTC (permalink / raw)
To: linux-hotplug
On Mon, Aug 17, 2009 at 23:13, Daniel Mierswa<impulze@impulze.org> wrote:
> Alan Jenkins wrote:
>> nak. The intention would have been to catch an "out of memory error"
>> when allocating devpaths. It should make sense if you replace "index"
>> with "devpaths" on that line instead,
> done
>
> New patch attached.
Applied.
Thanks,
Kay
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-18 0:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-17 14:19 [PATCH] Don't compare a non-existing function with NULL Daniel Mierswa
2009-08-17 21:06 ` Alan Jenkins
2009-08-17 21:13 ` Daniel Mierswa
2009-08-18 0:01 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).