[Patches] [ python-Patches-416250 ] 2.1c1 thread_pthread: unused vrbl clean

noreply@sourceforge.net noreply@sourceforge.net
Wed, 09 May 2001 12:57:41 -0700


Patches item #416250, was updated on 2001-04-15 04:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=416250&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Mark Favas (mfavas)
>Assigned to: Tim Peters (tim_one)
Summary: 2.1c1 thread_pthread: unused vrbl  clean

Initial Comment:
Variables set but not used

*** thread_pthread.h.orig       Sun Apr 15 18:30:22
2001
--- thread_pthread.h    Sun Apr 15 18:32:02 2001
***************
*** 273,279 ****
  PyThread_free_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status, error = 0;
  
        dprintf(("PyThread_free_lock(%p) called\n",
lock));
  
--- 273,279 ----
  PyThread_free_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status;
  
        dprintf(("PyThread_free_lock(%p) called\n",
lock));
  
***************
*** 328,334 ****
  PyThread_release_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status, error = 0;
  
        dprintf(("PyThread_release_lock(%p) called\n",
lock));
  
--- 328,334 ----
  PyThread_release_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status;
  
        dprintf(("PyThread_release_lock(%p) called\n",
lock));
  
***************
*** 386,392 ****
  void 
  PyThread_free_sema(PyThread_type_sema sema)
  {
!       int status, error = 0;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_free_sema(%p) called\n", 
sema));
--- 386,392 ----
  void 
  PyThread_free_sema(PyThread_type_sema sema)
  {
!       int status;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_free_sema(%p) called\n", 
sema));
***************
*** 430,436 ****
  void 
  PyThread_up_sema(PyThread_type_sema sema)
  {
!       int status, error = 0;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_up_sema(%p)\n",  sema));
--- 430,436 ----
  void 
  PyThread_up_sema(PyThread_type_sema sema)
  {
!       int status;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_up_sema(%p)\n",  sema));


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-05-09 12:57

Message:
Logged In: YES 
user_id=31435

Rejected as requested.  But you could, e.g., instead change 
the "error = 1" part of the macro to "set_error(&error)" 
and define a

static void
set_error(int* error) {*error = 1;}

function near the top of the file.  Then the unused var 
wngs should go away, and the oost of an extra function call 
in case there *is* an error is insignificant.

If I had a pthreads box with a picky compiler to test it 
on, I'd do that myself.

----------------------------------------------------------------------

Comment By: Mark Favas (mfavas)
Date: 2001-04-15 04:36

Message:
Logged In: YES 
user_id=44979

Aaaaaaaaargh! Ignore this one - sorry! I rebuilt after
changing this, but thread.c (which depends on this include
file) was not rebuilt automatically (makefile dependency
needs fixing, I guess). Errors ensued when I recompiled
thread.c - error is set in the macro CHECK_STATUS and
sometimes used and sometimes not - would require making two
macros, so not worth doing.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=416250&group_id=5470