mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-05 21:00:05 +00:00
Some more optimizations.
This commit is contained in:
parent
e1fff0e7bf
commit
7cc7c0f7e7
@ -102,18 +102,19 @@ __get_clockfreq_via_proc_openprom (void)
|
|||||||
|
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
char node_name[strlen ("/proc/openprom/")
|
char node[strlen ("/proc/openprom/")
|
||||||
+ _D_ALLOC_NAMLEN (this_dirp)
|
+ _D_ALLOC_NAMLEN (this_dirp)
|
||||||
+ strlen ("/clock-frequency")];
|
+ strlen ("/clock-frequency")];
|
||||||
|
char *prop;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* Note that
|
/* Note that
|
||||||
strlen("/clock-frequency") > strlen("/device_type")
|
strlen("/clock-frequency") > strlen("/device_type")
|
||||||
*/
|
*/
|
||||||
stpcpy (stpcpy (stpcpy (node_name, "/proc/openprom/"),
|
__stpcpy (prop = __stpcpy (__stpcpy (node, "/proc/openprom/"),
|
||||||
this_dirp->d_name),
|
this_dirp->d_name),
|
||||||
"/device_type");
|
"/device_type");
|
||||||
fd = open (node_name, O_RDONLY);
|
fd = open (node, O_RDONLY);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
char type_string[128];
|
char type_string[128];
|
||||||
@ -124,10 +125,8 @@ __get_clockfreq_via_proc_openprom (void)
|
|||||||
{
|
{
|
||||||
int clkfreq_fd;
|
int clkfreq_fd;
|
||||||
|
|
||||||
stpcpy (stpcpy (stpcpy (node_name, "/proc/openprom/"),
|
__stpcpy (prop, "/clock-frequency");
|
||||||
this_dirp->d_name),
|
clkfreq_fd = open (node, O_RDONLY);
|
||||||
"/clock-frequency");
|
|
||||||
clkfreq_fd = open (node_name, O_RDONLY);
|
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
if (read (clkfreq_fd, type_string,
|
if (read (clkfreq_fd, type_string,
|
||||||
|
Loading…
Reference in New Issue
Block a user