1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

Remove set-but-unused variables from libguile.

* libguile/filesys.c (scm_readdir): Remove set-but-unused `namlen' variable.
* libguile/fports.c (fport_flush): Same for `written'.
* libguile/gc-segment.c (scm_i_initialize_heap_segment_data): Same
  for `bvec_ptr'.
* libguile/posix.c (scm_nice): Same for `nice_value'.
* libguile/scmsigs.c (take_signal): Same for `count'.
* libguile/srfi-4.c (uvec_to_list): Same for `elts'.
* libguile/stacks.c (scm_stack_ref): Same for `c_index'.
* libguile/threads.c (scm_std_select): Same for `count'.
* libguile/throw.c (scm_ithrow): Same for `answer'.
* libguile/unif.c (scm_i_read_array): Same for `got_rank'.
This commit is contained in:
Ludovic Courtès 2012-05-23 14:55:38 +02:00
parent e254747644
commit 93f68a5ac4
10 changed files with 34 additions and 41 deletions

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2008,
* * 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -904,7 +905,7 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
{ {
struct dirent_or_dirent64 de; /* just for sizeof */ struct dirent_or_dirent64 de; /* just for sizeof */
DIR *ds = (DIR *) SCM_CELL_WORD_1 (port); DIR *ds = (DIR *) SCM_CELL_WORD_1 (port);
size_t namlen;
#ifdef NAME_MAX #ifdef NAME_MAX
char buf [SCM_MAX (sizeof (de), char buf [SCM_MAX (sizeof (de),
sizeof (de) - sizeof (de.d_name) + NAME_MAX + 1)]; sizeof (de) - sizeof (de.d_name) + NAME_MAX + 1)];
@ -924,8 +925,6 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
if (! rdent) if (! rdent)
return SCM_EOF_VAL; return SCM_EOF_VAL;
namlen = NAMLEN (rdent);
return (rdent ? scm_from_locale_stringn (rdent->d_name, NAMLEN (rdent)) return (rdent ? scm_from_locale_stringn (rdent->d_name, NAMLEN (rdent))
: SCM_EOF_VAL); : SCM_EOF_VAL);
} }

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* * 2006, 2008, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -843,11 +844,10 @@ fport_flush (SCM port)
{ {
const char *msg = "Error: could not flush file-descriptor "; const char *msg = "Error: could not flush file-descriptor ";
char buf[11]; char buf[11];
size_t written;
written = write (2, msg, strlen (msg)); (void) write (2, msg, strlen (msg));
sprintf (buf, "%d\n", fp->fdes); sprintf (buf, "%d\n", fp->fdes);
written = write (2, buf, strlen (buf)); (void) write (2, buf, strlen (buf));
count = remaining; count = remaining;
} }

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2006, 2008,
* 2012 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -89,7 +90,6 @@ scm_i_initialize_heap_segment_data (scm_t_heap_segment * segment, size_t request
size_t mem_needed = (1+card_count) * SCM_GC_SIZEOF_CARD size_t mem_needed = (1+card_count) * SCM_GC_SIZEOF_CARD
+ SCM_GC_CARD_BVEC_SIZE_IN_LONGS * card_count * SCM_SIZEOF_LONG + SCM_GC_CARD_BVEC_SIZE_IN_LONGS * card_count * SCM_SIZEOF_LONG
; ;
scm_t_c_bvec_long * bvec_ptr = 0;
scm_t_cell * memory = 0; scm_t_cell * memory = 0;
/* /*
@ -106,8 +106,6 @@ scm_i_initialize_heap_segment_data (scm_t_heap_segment * segment, size_t request
segment->bounds[1] = segment->bounds[0] + card_count * SCM_GC_CARD_N_CELLS; segment->bounds[1] = segment->bounds[0] + card_count * SCM_GC_CARD_N_CELLS;
segment->freelist->heap_size += scm_i_segment_cell_count (segment); segment->freelist->heap_size += scm_i_segment_cell_count (segment);
bvec_ptr = (scm_t_c_bvec_long*) segment->bounds[1];
/* /*
Don't init the mem or the bitvector. This is handled by lazy Don't init the mem or the bitvector. This is handled by lazy

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* * 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -1543,12 +1544,10 @@ SCM_DEFINE (scm_nice, "nice", 1, 0, 0,
"The return value is unspecified.") "The return value is unspecified.")
#define FUNC_NAME s_scm_nice #define FUNC_NAME s_scm_nice
{ {
int nice_value;
/* nice() returns "prio-NZERO" on success or -1 on error, but -1 can arise /* nice() returns "prio-NZERO" on success or -1 on error, but -1 can arise
from "prio-NZERO", so an error must be detected from errno changed */ from "prio-NZERO", so an error must be detected from errno changed */
errno = 0; errno = 0;
nice_value = nice (scm_to_int (incr)); (void) nice (scm_to_int (incr));
if (errno != 0) if (errno != 0)
SCM_SYSERROR; SCM_SYSERROR;

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006,
* 2007, 2012 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -137,10 +138,9 @@ static int signal_pipe[2];
static SIGRETTYPE static SIGRETTYPE
take_signal (int signum) take_signal (int signum)
{ {
size_t count;
char sigbyte = signum; char sigbyte = signum;
count = write (signal_pipe[1], &sigbyte, 1); (void) write (signal_pipe[1], &sigbyte, 1);
#ifndef HAVE_SIGACTION #ifndef HAVE_SIGACTION
signal (signum, take_signal); signal (signum, take_signal);

View file

@ -1,6 +1,6 @@
/* srfi-4.c --- Uniform numeric vector datatypes. /* srfi-4.c --- Uniform numeric vector datatypes.
* *
* Copyright (C) 2001, 2004, 2006, 2010 Free Software Foundation, Inc. * Copyright (C) 2001, 2004, 2006, 2010, 2012 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -396,10 +396,9 @@ uvec_to_list (int type, SCM uvec)
scm_t_array_handle handle; scm_t_array_handle handle;
size_t len; size_t len;
ssize_t i, inc; ssize_t i, inc;
const void *elts;
SCM res = SCM_EOL; SCM res = SCM_EOL;
elts = uvec_elements (type, uvec, &handle, &len, &inc); (void) uvec_elements (type, uvec, &handle, &len, &inc);
for (i = len*inc; i > 0;) for (i = len*inc; i > 0;)
{ {
i -= inc; i -= inc;

View file

@ -1,5 +1,5 @@
/* Representation of stack frame debug information /* Representation of stack frame debug information
* Copyright (C) 1996,1997,2000,2001, 2006, 2007, 2008 Free Software Foundation * Copyright (C) 1996,1997,2000,2001, 2006, 2007, 2008, 2012 Free Software Foundation
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -552,10 +552,8 @@ SCM_DEFINE (scm_stack_ref, "stack-ref", 2, 0, 0,
"Return the @var{index}'th frame from @var{stack}.") "Return the @var{index}'th frame from @var{stack}.")
#define FUNC_NAME s_scm_stack_ref #define FUNC_NAME s_scm_stack_ref
{ {
unsigned long int c_index;
SCM_VALIDATE_STACK (1, stack); SCM_VALIDATE_STACK (1, stack);
c_index = scm_to_unsigned_integer (index, 0, SCM_STACK_LENGTH(stack)-1); (void) scm_to_unsigned_integer (index, 0, SCM_STACK_LENGTH (stack) - 1);
return scm_cons (stack, index); return scm_cons (stack, index);
} }
#undef FUNC_NAME #undef FUNC_NAME

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
* * 2006, 2008, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -1455,9 +1456,8 @@ scm_std_select (int nfds,
if (res > 0 && FD_ISSET (wakeup_fd, readfds)) if (res > 0 && FD_ISSET (wakeup_fd, readfds))
{ {
char dummy; char dummy;
size_t count;
count = read (wakeup_fd, &dummy, 1); (void) read (wakeup_fd, &dummy, 1);
FD_CLR (wakeup_fd, readfds); FD_CLR (wakeup_fd, readfds);
res -= 1; res -= 1;

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2004, 2006, 2008,
* * 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -752,7 +753,7 @@ scm_ithrow (SCM key, SCM args, int noreturn SCM_UNUSED)
{ {
struct pre_unwind_data *c = struct pre_unwind_data *c =
(struct pre_unwind_data *) SCM_CELL_WORD_1 (jmpbuf); (struct pre_unwind_data *) SCM_CELL_WORD_1 (jmpbuf);
SCM handle, answer; SCM handle;
/* For old-style lazy-catch behaviour, we unwind the dynamic /* For old-style lazy-catch behaviour, we unwind the dynamic
context before invoking the handler. */ context before invoking the handler. */
@ -776,7 +777,7 @@ scm_ithrow (SCM key, SCM args, int noreturn SCM_UNUSED)
c, c,
SCM_F_WIND_EXPLICITLY); SCM_F_WIND_EXPLICITLY);
scm_dynwind_unwind_handler (toggle_pre_unwind_running, c, 0); scm_dynwind_unwind_handler (toggle_pre_unwind_running, c, 0);
answer = (c->handler) (c->handler_data, key, args); (c->handler) (c->handler_data, key, args);
/* There is deliberately no scm_dynwind_end call here. This /* There is deliberately no scm_dynwind_end call here. This
means that the unwind handler (toggle_pre_unwind_running) means that the unwind handler (toggle_pre_unwind_running)

View file

@ -1,5 +1,6 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2011 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
* * 2006, 2011, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -2676,7 +2677,6 @@ SCM
scm_i_read_array (SCM port, int c) scm_i_read_array (SCM port, int c)
{ {
ssize_t rank; ssize_t rank;
int got_rank;
char tag[80]; char tag[80];
int tag_len; int tag_len;
@ -2704,7 +2704,6 @@ scm_i_read_array (SCM port, int c)
return SCM_BOOL_F; return SCM_BOOL_F;
} }
rank = 1; rank = 1;
got_rank = 1;
tag[0] = 'f'; tag[0] = 'f';
tag_len = 1; tag_len = 1;
goto continue_reading_tag; goto continue_reading_tag;