[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] src/sort.c: sort() is always called with nfiles > 0
From: |
Kovarththanan Rajaratnam |
Subject: |
[PATCH] src/sort.c: sort() is always called with nfiles > 0 |
Date: |
Wed, 6 Jan 2010 09:36:07 +0100 |
clang detected the following false positive:
sort.c:2946:3: warning: Pass-by-value argument in function call is undefined
free (buf.buf);
^ ~~~~~~~
src/sort.c: Add an assert indicating that sort() is always called with nfiles >
0. This allows clang to deduce that 'buf.buf' is always set/valid.
Signed-off-by: Kovarththanan Rajaratnam <address@hidden>
---
src/sort.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/sort.c b/src/sort.c
index 9c25723..039df13 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2874,6 +2874,8 @@ sort (char * const *files, size_t nfiles, char const
*output_file)
buf.alloc = 0;
+ assert(nfiles > 0);
+
while (nfiles)
{
char const *temp_output;
--
1.6.3.3
- [PATCH] src/sort.c: sort() is always called with nfiles > 0,
Kovarththanan Rajaratnam <=