Changeset 3370 in vbox
- Timestamp:
- Jul 3, 2007 12:52:41 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c
r3369 r3370 50 50 */ 51 51 52 #if defined(VBOX) 53 #define IN_RING3 54 #include <iprt/initterm.h> /* for RTR3Init */ 55 #include <iprt/log.h> 56 #endif 57 52 58 #include "primpl.h" 53 59 #include "prenv.h" 54 60 #include "prprf.h" 55 61 #include <string.h> 56 57 #if defined(VBOX)58 #define IN_RING359 #include <iprt/runtime.h> /* for RTR3Init */60 #include <iprt/log.h>61 #endif62 62 63 63 /* … … 125 125 */ 126 126 #if defined(VBOX) 127 #if defined(_PR_USE_STDIO_FOR_LOGGING) 127 128 #define IPRT_DEBUG_FILE (FILE*)-3 129 #else 130 #define IPRT_DEBUG_FILE (PRFileDesc*)-3 131 #endif 128 132 #endif 129 133 130 134 /* Macros used to reduce #ifdef pollution */ 131 135 132 #if defined( VBOX)133 #define _ PUT_LOG(fd, buf, nb) \136 #if defined(_PR_USE_STDIO_FOR_LOGGING) && defined(XP_PC) 137 #define __PUT_LOG(fd, buf, nb) \ 134 138 PR_BEGIN_MACRO \ 135 if (logFile == IPRT_DEBUG_FILE) { \ 136 Log(("%*.*S", nb, nb, buf)); \ 137 } else { \ 138 fwrite(buf, 1, nb, fd); \ 139 fflush(fd); \ 140 } \ 141 PR_END_MACRO 142 #elif defined(_PR_USE_STDIO_FOR_LOGGING) && defined(XP_PC) 143 #define _PUT_LOG(fd, buf, nb) \ 144 PR_BEGIN_MACRO \ 145 if (logFile == WIN32_DEBUG_FILE) { \ 139 if (fd == WIN32_DEBUG_FILE) { \ 146 140 char savebyte = buf[nb]; \ 147 141 buf[nb] = '\0'; \ … … 154 148 PR_END_MACRO 155 149 #elif defined(_PR_USE_STDIO_FOR_LOGGING) 156 #define _ PUT_LOG(fd, buf, nb) {fwrite(buf, 1, nb, fd); fflush(fd);}150 #define __PUT_LOG(fd, buf, nb) {fwrite(buf, 1, nb, fd); fflush(fd);} 157 151 #elif defined(_PR_PTHREADS) 158 #define _ PUT_LOG(fd, buf, nb) PR_Write(fd, buf, nb)152 #define __PUT_LOG(fd, buf, nb) PR_Write(fd, buf, nb) 159 153 #elif defined(XP_MAC) 160 #define _PUT_LOG(fd, buf, nb) _PR_MD_WRITE_SYNC(fd, buf, nb) 161 #else 162 #define _PUT_LOG(fd, buf, nb) _PR_MD_WRITE(fd, buf, nb) 154 #define __PUT_LOG(fd, buf, nb) _PR_MD_WRITE_SYNC(fd, buf, nb) 155 #else 156 #define __PUT_LOG(fd, buf, nb) _PR_MD_WRITE(fd, buf, nb) 157 #endif 158 159 #if defined(VBOX) 160 #define _PUT_LOG(fd, buf, nb) \ 161 PR_BEGIN_MACRO \ 162 if (fd == IPRT_DEBUG_FILE) { \ 163 Log(("%*.*S", nb, nb, buf)); \ 164 } else { \ 165 __PUT_LOG(fd, buf, nb); \ 166 } \ 167 PR_END_MACRO 168 #else 169 #define _PUT_LOG(fd, buf, nb) __PUT_LOG(fd, buf, nb) 163 170 #endif 164 171
Note:
See TracChangeset
for help on using the changeset viewer.