From root@mail.vader.dk  Tue Mar  1 13:58:45 2011
Return-Path: <root@mail.vader.dk>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D76FD106566B;
	Tue,  1 Mar 2011 13:58:45 +0000 (UTC)
	(envelope-from root@mail.vader.dk)
Received: from mail.vader.dk (0x55535569.adsl.cybercity.dk [85.83.85.105])
	by mx1.freebsd.org (Postfix) with ESMTP id 398818FC14;
	Tue,  1 Mar 2011 13:58:44 +0000 (UTC)
Received: from mail.vader.dk (mail.vader.dk [192.168.1.12])
	by mail.vader.dk (8.14.4/8.14.4) with ESMTP id p21Dchv5010227
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 1 Mar 2011 13:38:44 GMT
	(envelope-from root@mail.vader.dk)
Received: (from root@localhost)
	by mail.vader.dk (8.14.4/8.14.4/Submit) id p21DchU2010226;
	Tue, 1 Mar 2011 13:38:43 GMT
	(envelope-from root)
Message-Id: <201103011338.p21DchU2010226@mail.vader.dk>
Date: Tue, 1 Mar 2011 13:38:43 GMT
From: darth@vader.dk
To: FreeBSD-gnats-submit@freebsd.org
Cc: vanilla@freebsd.org
Subject: [PATCH] devel/jansson: Fix compiler warnings when using library header files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         155154
>Category:       ports
>Synopsis:       [PATCH] devel/jansson: Fix compiler warnings when using library header files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    vanilla
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 01 14:00:20 UTC 2011
>Closed-Date:    Wed Apr 13 06:43:17 UTC 2011
>Last-Modified:  Wed Apr 13 06:50:10 UTC 2011
>Originator:     Chris Larsen
>Release:        FreeBSD 8.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD vader.dj.s 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010
>Description:

Essentially the same fix as PR ports/154109 which corrected the same issue
just with devel/jansson version: 1.3

Fix compiler warnings when including the libraries header file(s), 'index' has
been used as variable name and thus generates a shadowed global declaration
warning with 'gcc' flag -Wshadow.

Patch does the following;
Renamed variable: index -> my_index

Added file(s):
- files/patch-fix_index_variable

Port maintainer (vanilla@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:

make WARNS >= 4 (FreeBSD 8.1) and including jansson.h in source

>Fix:

--- jansson-2.0_1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/devel/jansson/Makefile /home/vader/ports/devel/jansson/Makefile
--- /usr/ports/devel/jansson/Makefile	2011-03-01 13:17:42.000000000 +0000
+++ /home/vader/ports/devel/jansson/Makefile	2011-03-01 13:20:39.000000000 +0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	jansson
 PORTVERSION=	2.0
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	http://www.digip.org/jansson/releases/
 
diff -ruN --exclude=CVS /usr/ports/devel/jansson/files/patch-fix_index_variable /home/vader/ports/devel/jansson/files/patch-fix_index_variable
--- /usr/ports/devel/jansson/files/patch-fix_index_variable	1970-01-01 00:00:00.000000000 +0000
+++ /home/vader/ports/devel/jansson/files/patch-fix_index_variable	2011-03-01 13:14:09.000000000 +0000
@@ -0,0 +1,207 @@
+diff -u src/hashtable.c src/hashtable.c
+--- src/hashtable.c	2011-02-19 12:57:37.000000000 +0100
++++ src/hashtable.c	2011-03-01 14:00:27.000000000 +0100
+@@ -101,10 +101,10 @@
+ {
+     pair_t *pair;
+     bucket_t *bucket;
+-    size_t index;
++    size_t my_index;
+ 
+-    index = hash % num_buckets(hashtable);
+-    bucket = &hashtable->buckets[index];
++    my_index = hash % num_buckets(hashtable);
++    bucket = &hashtable->buckets[my_index];
+ 
+     pair = hashtable_find_pair(hashtable, bucket, key, hash);
+     if(!pair)
+@@ -153,7 +153,7 @@
+ {
+     list_t *list, *next;
+     pair_t *pair;
+-    size_t i, index, new_size;
++    size_t i, my_index, new_size;
+ 
+     jsonp_free(hashtable->buckets);
+ 
+@@ -176,8 +176,8 @@
+     for(; list != &hashtable->list; list = next) {
+         next = list->next;
+         pair = list_to_pair(list);
+-        index = pair->hash % new_size;
+-        insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list);
++        my_index = pair->hash % new_size;
++        insert_to_bucket(hashtable, &hashtable->buckets[my_index], &pair->list);
+     }
+ 
+     return 0;
+@@ -244,7 +244,7 @@
+ {
+     pair_t *pair;
+     bucket_t *bucket;
+-    size_t hash, index;
++    size_t hash, my_index;
+ 
+     /* rehash if the load ratio exceeds 1 */
+     if(hashtable->size >= num_buckets(hashtable))
+@@ -252,8 +252,8 @@
+             return -1;
+ 
+     hash = hashtable->hash_key(key);
+-    index = hash % num_buckets(hashtable);
+-    bucket = &hashtable->buckets[index];
++    my_index = hash % num_buckets(hashtable);
++    bucket = &hashtable->buckets[my_index];
+     pair = hashtable_find_pair(hashtable, bucket, key, hash);
+ 
+     if(pair)
+diff -u src/jansson.h src/jansson.h
+--- src/jansson.h	2011-02-25 20:09:04.000000000 +0100
++++ src/jansson.h	2011-03-01 14:00:10.000000000 +0100
+@@ -152,18 +152,18 @@
+ }
+ 
+ size_t json_array_size(const json_t *array);
+-json_t *json_array_get(const json_t *array, size_t index);
+-int json_array_set_new(json_t *array, size_t index, json_t *value);
++json_t *json_array_get(const json_t *array, size_t my_index);
++int json_array_set_new(json_t *array, size_t my_index, json_t *value);
+ int json_array_append_new(json_t *array, json_t *value);
+-int json_array_insert_new(json_t *array, size_t index, json_t *value);
+-int json_array_remove(json_t *array, size_t index);
++int json_array_insert_new(json_t *array, size_t my_index, json_t *value);
++int json_array_remove(json_t *array, size_t my_index);
+ int json_array_clear(json_t *array);
+ int json_array_extend(json_t *array, json_t *other);
+ 
+ static JSON_INLINE
+-int json_array_set(json_t *array, size_t index, json_t *value)
++int json_array_set(json_t *array, size_t my_index, json_t *value)
+ {
+-    return json_array_set_new(array, index, json_incref(value));
++    return json_array_set_new(array, my_index, json_incref(value));
+ }
+ 
+ static JSON_INLINE
+@@ -173,9 +173,9 @@
+ }
+ 
+ static JSON_INLINE
+-int json_array_insert(json_t *array, size_t index, json_t *value)
++int json_array_insert(json_t *array, size_t my_index, json_t *value)
+ {
+-    return json_array_insert_new(array, index, json_incref(value));
++    return json_array_insert_new(array, my_index, json_incref(value));
+ }
+ 
+ const char *json_string_value(const json_t *string);
+diff -u src/value.c src/value.c
+--- src/value.c	2011-02-19 12:57:37.000000000 +0100
++++ src/value.c	2011-03-01 13:59:49.000000000 +0100
+@@ -390,20 +390,20 @@
+     return json_to_array(json)->entries;
+ }
+ 
+-json_t *json_array_get(const json_t *json, size_t index)
++json_t *json_array_get(const json_t *json, size_t my_index)
+ {
+     json_array_t *array;
+     if(!json_is_array(json))
+         return NULL;
+     array = json_to_array(json);
+ 
+-    if(index >= array->entries)
++    if(my_index >= array->entries)
+         return NULL;
+ 
+-    return array->table[index];
++    return array->table[my_index];
+ }
+ 
+-int json_array_set_new(json_t *json, size_t index, json_t *value)
++int json_array_set_new(json_t *json, size_t my_index, json_t *value)
+ {
+     json_array_t *array;
+ 
+@@ -417,14 +417,14 @@
+     }
+     array = json_to_array(json);
+ 
+-    if(index >= array->entries)
++    if(my_index >= array->entries)
+     {
+         json_decref(value);
+         return -1;
+     }
+ 
+-    json_decref(array->table[index]);
+-    array->table[index] = value;
++    json_decref(array->table[my_index]);
++    array->table[my_index] = value;
+ 
+     return 0;
+ }
+@@ -496,7 +496,7 @@
+     return 0;
+ }
+ 
+-int json_array_insert_new(json_t *json, size_t index, json_t *value)
++int json_array_insert_new(json_t *json, size_t my_index, json_t *value)
+ {
+     json_array_t *array;
+     json_t **old_table;
+@@ -510,7 +510,7 @@
+     }
+     array = json_to_array(json);
+ 
+-    if(index > array->entries) {
++    if(my_index > array->entries) {
+         json_decref(value);
+         return -1;
+     }
+@@ -522,21 +522,21 @@
+     }
+ 
+     if(old_table != array->table) {
+-        array_copy(array->table, 0, old_table, 0, index);
+-        array_copy(array->table, index + 1, old_table, index,
+-                   array->entries - index);
++        array_copy(array->table, 0, old_table, 0, my_index);
++        array_copy(array->table, my_index + 1, old_table, my_index,
++                   array->entries - my_index);
+         jsonp_free(old_table);
+     }
+     else
+-        array_move(array, index + 1, index, array->entries - index);
++        array_move(array, my_index + 1, my_index, array->entries - my_index);
+ 
+-    array->table[index] = value;
++    array->table[my_index] = value;
+     array->entries++;
+ 
+     return 0;
+ }
+ 
+-int json_array_remove(json_t *json, size_t index)
++int json_array_remove(json_t *json, size_t my_index)
+ {
+     json_array_t *array;
+ 
+@@ -544,12 +544,12 @@
+         return -1;
+     array = json_to_array(json);
+ 
+-    if(index >= array->entries)
++    if(my_index >= array->entries)
+         return -1;
+ 
+-    json_decref(array->table[index]);
++    json_decref(array->table[my_index]);
+ 
+-    array_move(array, index, index + 1, array->entries - index);
++    array_move(array, my_index, my_index + 1, array->entries - my_index);
+     array->entries--;
+ 
+     return 0;
--- jansson-2.0_1.patch ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->vanilla 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Mar 1 14:00:40 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=155154 
State-Changed-From-To: open->closed 
State-Changed-By: vanilla 
State-Changed-When: Wed Apr 13 06:43:15 UTC 2011 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=155154 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/155154: commit references a PR
Date: Wed, 13 Apr 2011 06:42:44 +0000 (UTC)

 vanilla     2011-04-13 06:42:27 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/jansson        Makefile distinfo 
   Added files:
     devel/jansson/files  patch-src_hashtable.c patch-src_jansson.h 
                          patch-src_value.c 
   Log:
   1: upgrade to 2.0.1
   2: fix compier warnings
   
   PR:             ports/155154 [2]
   Submitted by:   darth at vader.dk [2]
   
   Revision  Changes    Path
   1.6       +1 -1      ports/devel/jansson/Makefile
   1.5       +2 -2      ports/devel/jansson/distinfo
   1.1       +56 -0     ports/devel/jansson/files/patch-src_hashtable.c (new)
   1.1       +39 -0     ports/devel/jansson/files/patch-src_jansson.h (new)
   1.1       +107 -0    ports/devel/jansson/files/patch-src_value.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
