[git] GnuPG - branch, master, updated. gnupg-2.1.15-109-g68eb5fb
by NIIBE Yutaka
cvs at cvs.gnupg.org
Thu Sep 15 02:24:47 CEST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, master has been updated
via 68eb5fbd37c31ed7c0c916656131eea7bb58d13d (commit)
from 9799b5d18f8fd29872b75c4d70d370af2b4e9a89 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 68eb5fbd37c31ed7c0c916656131eea7bb58d13d
Author: NIIBE Yutaka <gniibe at fsij.org>
Date: Thu Sep 15 09:17:59 2016 +0900
tests/gpgscm: Fix use of pointer.
* tests/gpgscm/scheme-private.h (struct scheme): Use (void *) for
alloc_seg.
* tests/gpgscm/scheme.c (alloc_cellseg): Use (void *) for cp. Use
(void *) for coercion of address calculation.
--
In old C language, (char *) means an address. In modern C, it's
specifically an address with alignment=1. It's good to use (void *) for
an address, because newer compiler emits warnings. Note: in this
particular case, it is just a warning and the code is safe against
invalid alignment, though.
Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
index 9eafe76..727e0c0 100644
--- a/tests/gpgscm/scheme-private.h
+++ b/tests/gpgscm/scheme-private.h
@@ -78,7 +78,7 @@ int tracing;
#ifndef CELL_NSEGMENT
#define CELL_NSEGMENT 10 /* # of segments for cells */
#endif
-char *alloc_seg[CELL_NSEGMENT];
+void *alloc_seg[CELL_NSEGMENT];
pointer cell_seg[CELL_NSEGMENT];
int last_cell_seg;
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 1fc7643..8833950 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -602,7 +602,7 @@ static int alloc_cellseg(scheme *sc, int n) {
pointer newp;
pointer last;
pointer p;
- char *cp;
+ void *cp;
long i;
int k;
int adj=ADJ;
@@ -614,14 +614,14 @@ static int alloc_cellseg(scheme *sc, int n) {
for (k = 0; k < n; k++) {
if (sc->last_cell_seg >= CELL_NSEGMENT - 1)
return k;
- cp = (char*) sc->malloc(CELL_SEGSIZE * sizeof(struct cell)+adj);
+ cp = sc->malloc(CELL_SEGSIZE * sizeof(struct cell)+adj);
if (cp == 0)
return k;
i = ++sc->last_cell_seg ;
sc->alloc_seg[i] = cp;
/* adjust in TYPE_BITS-bit boundary */
if(((unsigned long)cp)%adj!=0) {
- cp=(char*)(adj*((unsigned long)cp/adj+1));
+ cp=(void *)(adj*((unsigned long)cp/adj+1));
}
/* insert new segment in address order */
newp=(pointer)cp;
-----------------------------------------------------------------------
Summary of changes:
tests/gpgscm/scheme-private.h | 2 +-
tests/gpgscm/scheme.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list