Changeset 2907
- Timestamp:
- Sep 10, 2016, 12:33:26 AM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.kmk
r2899 r2907 58 58 TEMPLATE_BIN-KMK_INCS += glob 59 59 endif 60 TEMPLATE_BIN-KMK_LIBS = $( TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL)60 TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL) 61 61 ifdef ELECTRIC_HEAP # for electric heap (see electric.c) - windows only. 62 62 ifeq ($(KBUILD_TARGET),win) -
trunk/src/lib/msc_buffered_printf.c
r2906 r2907 1 1 /* $Id$ */ 2 2 /** @file 3 * printf and vprintfconsole optimizations for Windows/MSC.3 * printf, vprintf, fprintf, puts, fputs console optimizations for Windows/MSC. 4 4 */ 5 5 … … 42 42 #undef printf 43 43 #undef vprintf 44 #undef fprintf 44 45 #undef puts 45 46 #undef fputs … … 101 102 * Fallback. 102 103 */ 103 return fprintf(stdout, pszFormat, va); 104 return vfprintf(stdout, pszFormat, va); 105 } 106 107 108 /** 109 * Replaces fprintf for MSC to speed up console output. 110 * 111 * @returns chars written on success, -1 and errno on failure. 112 * @param pFile The output file/stream. 113 * @param pszFormat The format string. 114 * @param va Format arguments. 115 */ 116 __declspec(dllexport) 117 int __cdecl fprintf(FILE *pFile, const char *pszFormat, ...) 118 { 119 va_list va; 120 int cchRet; 121 122 /* 123 * If it's a TTY, try format into a stack buffer and output using our 124 * console optimized fwrite wrapper. 125 */ 126 if (*pszFormat != '\0') 127 { 128 int fd = fileno(pFile); 129 if (fd >= 0) 130 { 131 if (isatty(fd)) 132 { 133 char szTmp[8192]; 134 va_start(va, pszFormat); 135 cchRet = vsnprintf(szTmp, sizeof(szTmp), pszFormat, va); 136 va_end(va); 137 if (cchRet >= sizeof(szTmp) - 1) 138 return (int)maybe_con_fwrite(szTmp, cchRet, 1, pFile); 139 } 140 } 141 } 142 143 /* 144 * Fallback. 145 */ 146 va_start(va, pszFormat); 147 cchRet = vfprintf(pFile, pszFormat, va); 148 va_end(va); 149 return cchRet; 104 150 } 105 151 … … 200 246 void * const __imp_printf = (void *)(uintptr_t)printf; 201 247 void * const __imp_vprintf = (void *)(uintptr_t)vprintf; 248 void * const __imp_fprintf = (void *)(uintptr_t)fprintf; 202 249 void * const __imp_puts = (void *)(uintptr_t)puts; 203 250 void * const __imp_fputs = (void *)(uintptr_t)fputs;
Note:
See TracChangeset
for help on using the changeset viewer.