[tex-k] Patch for -Wall

Martin Schröder martin at oneiros.de
Tue Dec 27 18:05:58 CET 2005


Hi,
compiling kpathsea with -Wall gives these warnings:

../../../src/texk/kpathsea/pathsearch.c: In function `path_search':
../../../src/texk/kpathsea/pathsearch.c:291: warning: suggest explicit braces to avoid ambiguous `else'
../../../src/texk/kpathsea/tex-make.c: In function `set_maketex_mag':
../../../src/texk/kpathsea/tex-make.c:75: warning: too many arguments for format
../../../src/texk/kpathsea/tex-make.c: In function `maketex':
../../../src/texk/kpathsea/tex-make.c:437: warning: implicit declaration of function `wait'
../../../src/texk/kpathsea/tex-make.c:412: warning: unused variable `status'
../../../src/texk/kpathsea/xputenv.c:3: warning: `/*' within comment
../../../src/texk/kpathsea/xputenv.c: In function `xputenv':
../../../src/texk/kpathsea/xputenv.c:101: warning: passing arg 1 of `free' discards qualifiers from pointer target type

The attached patch fixes them.

Best
    Martin
-- 
                    http://www.tm.oneiros.de
-------------- next part --------------
diff -dcr /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/pathsearch.c kpathsea/pathsearch.c
*** /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/pathsearch.c	Tue Jul 26 13:47:34 2005
--- kpathsea/pathsearch.c	Tue Dec 27 17:11:55 2005
***************
*** 288,300 ****
      }
      
      /* Did we find anything anywhere?  */
!     if (found && STR_LIST (*found))
!       if (all)
          str_list_concat (&ret_list, *found);
!       else {
          str_list_add (&ret_list, STR_LIST_ELT (*found, 0));
          done = true;
        }
  
      /* Free the list space, if any (but not the elements).  */
      if (found) {
--- 288,301 ----
      }
      
      /* Did we find anything anywhere?  */
!     if (found && STR_LIST (*found)) {
!       if (all) {
          str_list_concat (&ret_list, *found);
!       } else {
          str_list_add (&ret_list, STR_LIST_ELT (*found, 0));
          done = true;
        }
+     }
  
      /* Free the list space, if any (but not the elements).  */
      if (found) {
diff -dcr /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/tex-make.c kpathsea/tex-make.c
*** /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/tex-make.c	Tue Jul 26 13:16:30 2005
--- kpathsea/tex-make.c	Tue Dec 27 17:15:25 2005
***************
*** 30,35 ****
--- 30,36 ----
  #include <kpathsea/readable.h>
  #include <kpathsea/tex-make.h>
  #include <kpathsea/variable.h>
+ #include <sys/wait.h>
  
  
  /* We never throw away stdout, since that is supposed to be the filename
***************
*** 72,78 ****
                    sprintf(q, "%u+%u/(%u*%u)", dpi/bdpi, dpi%bdpi, f, bdpi/f);
                }
            } else {
!               sprintf(q, "%u+%u/(4000 + %u)", dpi/bdpi, dpi%bdpi, bdpi, r);
            }
        }
    } else {
--- 73,79 ----
                    sprintf(q, "%u+%u/(%u*%u)", dpi/bdpi, dpi%bdpi, f, bdpi/f);
                }
            } else {
!               sprintf(q, "%u+%u/(4000 + %u)", dpi/bdpi, dpi%bdpi, bdpi);
            }
        }
    } else {
***************
*** 409,415 ****
        /* Parent */
        char buf[1024+1];
        int num;
-       int status;
  
        /* Clean up child file descriptors that we won't use anyway. */
        close(childin);
--- 410,415 ----
diff -dcr /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/xputenv.c kpathsea/xputenv.c
*** /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/kpathsea/xputenv.c	Sun Jul 10 11:26:19 2005
--- kpathsea/xputenv.c	Tue Dec 27 17:26:21 2005
***************
*** 1,4 ****
! /* xputenv.c: set an environment variable without return.
  
  /*
   *  Copyright 2003-05 Olaf Weber.
--- 1,4 ----
! /* xputenv.c: set an environment variable without return. */
  
  /*
   *  Copyright 2003-05 Olaf Weber.
***************
*** 98,104 ****
          saved_env = XRETALLOC(saved_env, saved_count, const char *);
      } else {
          /* We owned the old string. */
!         free(saved_env[cur_loc]);
      }
      saved_env[cur_loc] = cur_item;
  
--- 98,104 ----
          saved_env = XRETALLOC(saved_env, saved_count, const char *);
      } else {
          /* We owned the old string. */
!         free((char **)saved_env[cur_loc]);
      }
      saved_env[cur_loc] = cur_item;
  


More information about the tex-k mailing list