Explorar el Código

Remove xdirname()

dirname(3) should be shot to death.
master
sin hace 10 años
padre
commit
577e0284a1
Se han modificado 1 ficheros con 1 adiciones y 15 borrados
  1. +1
    -15
      noice.c

+ 1
- 15
noice.c Ver fichero

@@ -118,20 +118,6 @@ xrealpath(const char *path)
return p; return p;
} }


char *
xdirname(const char *path)
{
char *p, *tmp;

/* Some implementations of dirname(3) may modify `path' */
tmp = xstrdup(path);
p = dirname(tmp);
free(tmp);
if (p == NULL)
printerr(1, "dirname");
return p;
}

void void
spawn(const char *file, const char *arg) spawn(const char *file, const char *arg)
{ {
@@ -546,7 +532,7 @@ nochange:
if (strcmp(path, "/") == 0) { if (strcmp(path, "/") == 0) {
goto nochange; goto nochange;
} else { } else {
dir = xdirname(path); dir = dirname(path);
tmp = xmalloc(strlen(dir) + 1); tmp = xmalloc(strlen(dir) + 1);
strlcpy(tmp, dir, strlen(dir) + 1); strlcpy(tmp, dir, strlen(dir) + 1);
free(path); free(path);


||||||
x
 
000:0
Cargando…
Cancelar
Guardar