aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-11-08 11:06:21 +0100
committerBjörn Gustavsson <[email protected]>2011-11-08 11:06:21 +0100
commit4a67884525973f104e9b05ea80bc16ffc71fada8 (patch)
tree00ef8d308f061737d0b1c8a7cf65598737cd8246 /erts/emulator/sys
parent766a0a84f0b9e4b9341fb06364bf5430574588a6 (diff)
parent3d5cdb216fa5652bd8552ef4fa4eee310e543b42 (diff)
downloadotp-4a67884525973f104e9b05ea80bc16ffc71fada8.tar.gz
otp-4a67884525973f104e9b05ea80bc16ffc71fada8.tar.bz2
otp-4a67884525973f104e9b05ea80bc16ffc71fada8.zip
Merge branch 'bjorn/create-less-garbage'
* bjorn/create-less-garbage: Optimize filename:basename/1 to produce less garbage Optimize filename:extension/1 to produce less garbage sys.c for Unix: Undo caching of utsname in os_flavor() Pre-build the tuples returned by os:type/0 and os:version/0
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/unix/sys.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 94ec8dc8a0..20bfaad9aa 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -931,18 +931,13 @@ void
os_flavor(char* namebuf, /* Where to return the name. */
unsigned size) /* Size of name buffer. */
{
- static int called = 0;
- static struct utsname uts; /* Information about the system. */
-
- if (!called) {
- char* s;
+ struct utsname uts; /* Information about the system. */
+ char* s;
- (void) uname(&uts);
- called = 1;
- for (s = uts.sysname; *s; s++) {
- if (isupper((int) *s)) {
- *s = tolower((int) *s);
- }
+ (void) uname(&uts);
+ for (s = uts.sysname; *s; s++) {
+ if (isupper((int) *s)) {
+ *s = tolower((int) *s);
}
}
strcpy(namebuf, uts.sysname);