summaryrefslogtreecommitdiff
path: root/x11/gdm/patches/patch-af
blob: 79e22c01b00bb64e992b82adb2f945c7bd08b19d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
$NetBSD: patch-af,v 1.11 2004/06/20 21:25:46 jmmv Exp $

http://bugzilla.gnome.org/show_bug.cgi?id=142338

--- vicious-extensions/ve-misc.c.orig	2004-05-28 21:23:01.000000000 +0200
+++ vicious-extensions/ve-misc.c
@@ -342,110 +342,6 @@ ve_locale_exists (const char *loc)
 	return ret;
 }
 
-/**
- * ve_setenv:
- * @name: An environment variable name.
- * @value: The value to assign to the environment variable.
- * @overwrite: If %TRUE, overwrite the existing @name variable in the
- * environment.
- * 
- * Adds "@name=@value" to the environment. Note that on systems without setenv,
- * this leaks memory so please do not use inside a loop or anything like that.
- * The semantics are the same as the glibc setenv() (if setenv() exists, it is
- * used).
- *
- * If @overwrite is %FALSE and the variable already exists in the environment,
- * then %0 is returned and the value is not changed.
- *
- * Returns: %0 on success, %-1 on error
- * 
- **/
-#if ! GLIB_CHECK_VERSION(2,3,1)
-int
-ve_setenv (const char *name, const char *value, gboolean overwrite)
-{
-#if defined (HAVE_SETENV)
-	return setenv (name, value != NULL ? value : "", overwrite);
-#else
-	char *string;
-	
-	if (! overwrite && g_getenv (name) != NULL) {
-		return 0;
-	}
-	
-	/* This results in a leak when you overwrite existing
-	 * settings. It would be fairly easy to fix this by keeping
-	 * our own parallel array or hash table.
-	 */
-	string = g_strconcat (name, "=", value, NULL);
-	return putenv (string);
-#endif
-}
-#endif
-
-/**
- * ve_unsetenv:
- * @name: The environment variable to unset.
- * 
- * Description: Removes @name from the environment.
- * In case there is no native implementation of unsetenv,
- * this could cause leaks depending on the implementation of
- * environment.
- * 
- **/
-#if ! GLIB_CHECK_VERSION(2,3,1)
-void
-ve_unsetenv (const char *name)
-{
-#if defined (HAVE_SETENV)
-	unsetenv (name);
-#else
-	extern char **environ;
-	int i, len;
-
-	if (environ == NULL)
-		return;
-
-	len = strlen (name);
-	
-	/* Mess directly with the environ array.
-	 * This seems to be the only portable way to do this.
-	 */
-	for (i = 0; environ[i] != NULL; i++) {
-		if (strncmp (environ[i], name, len) == 0
-		    && environ[i][len + 1] == '=') {
-			break;
-		}
-	}
-	while (environ[i] != NULL) {
-		environ[i] = environ[i + 1];
-		i++;
-	}
-#endif
-}
-#endif
-
-/**
- * ve_clearenv:
- * 
- * Description: Clears out the environment completely.
- * In case there is no native implementation of clearenv,
- * this could cause leaks depending on the implementation
- * of environment.
- * 
- **/
-void
-ve_clearenv (void)
-{
-#ifdef HAVE_CLEARENV
-	clearenv ();
-#else
-	extern char **environ;
-	if (environ != NULL)
-		environ[0] = NULL;
-#endif
-}
-
 char *
 ve_find_prog_in_path (const char *prog, const char *path)
 {