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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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