kdrive: s/KdSaveString/strdup/g

This isn't even funny anymore.
This commit is contained in:
Adam Jackson 2009-04-03 11:06:50 -04:00
parent 91b697efde
commit d2690375df
12 changed files with 23 additions and 36 deletions

View File

@ -1073,7 +1073,7 @@ MouseInit (KdPointerInfo *pi)
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
pi->name = KdSaveString("Xephyr virtual mouse");
pi->name = strdup("Xephyr virtual mouse");
ephyrMouse = pi;
return Success;
}
@ -1127,7 +1127,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
xfree(ki->keySyms.map);
ki->keySyms.map = ephyrKeySyms.map;
ki->name = KdSaveString("Xephyr virtual keyboard");
ki->name = strdup("Xephyr virtual keyboard");
ephyrKbd = ki;
return Success;
}

View File

@ -77,7 +77,7 @@ BusInit (KdPointerInfo *pi)
close(fd);
if (pi->path)
xfree(pi->path);
pi->path = KdSaveString(BusNames[i]);
pi->path = strdup(BusNames[i]);
return Success;
}
}

View File

@ -209,7 +209,7 @@ EvdevPtrInit (KdPointerInfo *pi)
for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
fd = open (kdefaultEvdev[i], 2);
if (fd >= 0) {
pi->path = KdSaveString (kdefaultEvdev[i]);
pi->path = strdup (kdefaultEvdev[i]);
break;
}
}
@ -224,7 +224,7 @@ EvdevPtrInit (KdPointerInfo *pi)
close(fd);
pi->name = KdSaveString("Evdev mouse");
pi->name = strdup("Evdev mouse");
return Success;
}
@ -411,7 +411,7 @@ EvdevKbdInit (KdKeyboardInfo *ki)
close (fd);
ki->name = KdSaveString("Evdev keyboard");
ki->name = strdup("Evdev keyboard");
readMapping(ki);

View File

@ -737,10 +737,10 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
if (ki->path)
xfree(ki->path);
ki->path = KdSaveString("console");
ki->path = strdup("console");
if (ki->name)
xfree(ki->name);
ki->name = KdSaveString("Linux console keyboard");
ki->name = strdup("Linux console keyboard");
readKernelMapping (ki);

View File

@ -944,7 +944,7 @@ MouseInit (KdPointerInfo *pi)
for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
fd = open (kdefaultMouse[i], 2);
if (fd >= 0) {
pi->path = KdSaveString (kdefaultMouse[i]);
pi->path = strdup (kdefaultMouse[i]);
break;
}
}

View File

@ -100,9 +100,9 @@ MsInit (KdPointerInfo *pi)
return BadImplementation;
if (!pi->path || strcmp(pi->path, "auto"))
pi->path = KdSaveString("/dev/mouse");
pi->path = strdup("/dev/mouse");
if (!pi->name)
pi->name = KdSaveString("Microsoft protocol mouse");
pi->name = strdup("Microsoft protocol mouse");
return Success;
}

View File

@ -123,7 +123,7 @@ Ps2Init (KdPointerInfo *pi)
for (i = 0; i < NUM_PS2_NAMES; i++) {
ps2Port = open (Ps2Names[i], 0);
if (ps2Port >= 0) {
pi->path = KdSaveString (Ps2Names[i]);
pi->path = strdup (Ps2Names[i]);
break;
}
}
@ -137,7 +137,7 @@ Ps2Init (KdPointerInfo *pi)
close(ps2Port);
if (!pi->name)
pi->name = KdSaveString ("PS/2 Mouse");
pi->name = strdup ("PS/2 Mouse");
return Success;
}

View File

@ -169,7 +169,7 @@ TslibInit (KdPointerInfo *pi)
/* hacktastic */
private->phys_screen = 0;
pi->nAxes = 3;
pi->name = KdSaveString("Touchscreen");
pi->name = strdup("Touchscreen");
pi->inputClass = KD_TOUCHSCREEN;
return Success;

View File

@ -521,17 +521,6 @@ KdParseScreen (KdScreenInfo *screen,
* {NMO} Reorder buttons
*/
char *
KdSaveString (char *str)
{
char *n = (char *) xalloc (strlen (str) + 1);
if (!n)
return 0;
strcpy (n, str);
return n;
}
void
KdParseRgba (char *rgba)
{

View File

@ -24,6 +24,7 @@
#define _KDRIVE_H_
#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xos.h>
@ -468,9 +469,6 @@ void
KdParseScreen (KdScreenInfo *screen,
char *arg);
char *
KdSaveString (char *str);
KdPointerInfo *
KdParsePointer (char *arg);

View File

@ -118,7 +118,7 @@ KdNewPointer (void)
if (!pi)
return NULL;
pi->name = KdSaveString("Generic Pointer");
pi->name = strdup("Generic Pointer");
pi->path = NULL;
pi->inputClass = KD_MOUSE;
pi->driver = NULL;

View File

@ -870,9 +870,9 @@ KdNewKeyboard (void)
ki->bellDuration = 200;
ki->next = NULL;
ki->options = NULL;
ki->xkbRules = KdSaveString("base");
ki->xkbModel = KdSaveString("pc105");
ki->xkbLayout = KdSaveString("us");
ki->xkbRules = strdup("base");
ki->xkbModel = strdup("pc105");
ki->xkbLayout = strdup("us");
ki->xkbVariant = NULL;
ki->xkbOptions = NULL;
@ -1065,7 +1065,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
else if (strcasecmp(option->key, "XkbOptions") == 0)
ki->xkbOptions = option->value;
else if (!strcasecmp (option->key, "device"))
ki->path = KdSaveString(option->value);
ki->path = strdup(option->value);
else
ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
@ -1161,7 +1161,7 @@ KdParsePointerOptions (KdPointerInfo *pi)
else if (!strcmp (option->key, "rawcoord"))
pi->transformCoordinates = FALSE;
else if (!strcasecmp (option->key, "device"))
pi->path = KdSaveString(option->value);
pi->path = strdup(option->value);
else
ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
@ -2280,9 +2280,9 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
for (option = options; option; option = option->next) {
if (strcmp(option->key, "device") == 0) {
if (pi && option->value)
pi->path = KdSaveString(option->value);
pi->path = strdup(option->value);
else if (ki && option->value)
ki->path = KdSaveString(option->value);
ki->path = strdup(option->value);
}
else if (strcmp(option->key, "driver") == 0) {
if (pi) {