A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused variables.
[simgrid.git]
/
src
/
gras
/
Virtu
/
rl_dns.c
diff --git
a/src/gras/Virtu/rl_dns.c
b/src/gras/Virtu/rl_dns.c
index
f237901
..
8e7f9e9
100644
(file)
--- a/
src/gras/Virtu/rl_dns.c
+++ b/
src/gras/Virtu/rl_dns.c
@@
-1,6
+1,7
@@
/* rl_dns - name resolution (real life) */
/* rl_dns - name resolution (real life) */
-/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
+/* Copyright (c) 2005, 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-13,12
+14,11
@@
const char *gras_os_myname(void)
{
const char *gras_os_myname(void)
{
- static char *myname = NULL;
+ static char myname[255];
+ static int initialized = 0;
- if (myname)
- return (const char *) myname;
-
- myname = xbt_new(char, 255);
+ if (initialized)
+ return myname;
if (gethostname(myname, 255) == -1) {
#ifdef HAVE_SYS_SOCKET_H
if (gethostname(myname, 255) == -1) {
#ifdef HAVE_SYS_SOCKET_H
@@
-31,7
+31,7
@@
const char *gras_os_myname(void)
endhostent();
if (tmp) {
endhostent();
if (tmp) {
- strnc
at
(myname, tmp->h_name, 255);
+ strnc
py
(myname, tmp->h_name, 255);
} else {
/* Erm. localhost cannot be resolved. There's something wrong in the user DNS setting */
sprintf(myname, "(misconfigured host)");
} else {
/* Erm. localhost cannot be resolved. There's something wrong in the user DNS setting */
sprintf(myname, "(misconfigured host)");
@@
-43,5
+43,6
@@
const char *gras_os_myname(void)
myname[254] = '\0';
myname[254] = '\0';
+ initialized = 1;
return myname;
}
return myname;
}