Changeset 1021 for trunk/physmap.c


Ignore:
Timestamp:
05/31/10 00:24:40 (2 years ago)
Author:
hailfinger
Message:

Remove unneeded #include statements completely.

unistd.h was only used to get a definition of NULL in all files. Add our
own NULL #define and remove unistd.h from flash.h
stdio.h has no place in flash.h, it should be included only in files
which really need it.
Add #include statements in individual .c files where needed.

Replace a few printf with msg_* to eliminate the need for stdio.h.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Uwe Hermann <uwe@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/physmap.c

    r1013 r1021  
    2121 */ 
    2222 
     23#include <unistd.h> 
     24#include <stdio.h> 
    2325#include <sys/types.h> 
    2426#include <sys/stat.h> 
     
    311313{ 
    312314        char msrfilename[64]; 
    313         memset(msrfilename, 0, 64); 
    314         sprintf(msrfilename, "/dev/cpu/%d/msr", cpu); 
     315        memset(msrfilename, 0, sizeof(msrfilename)); 
     316        snprintf(msrfilename, sizeof(msrfilename), "/dev/cpu/%d/msr", cpu); 
    315317 
    316318        if (fd_msr != -1) { 
     
    394396{ 
    395397        char msrfilename[64]; 
    396         memset(msrfilename, 0, 64); 
    397         sprintf(msrfilename, "/dev/cpu%d", cpu); 
     398        memset(msrfilename, 0, sizeof(msrfilename)); 
     399        snprintf(msrfilename, sizeof(msrfilename), "/dev/cpu%d", cpu); 
    398400 
    399401        if (fd_msr != -1) { 
Note: See TracChangeset for help on using the changeset viewer.