Changeset 212 in Main for trunk/Common/log.c
- Timestamp:
- Oct 3, 2024, 2:44:55 AM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/log.c
r191 r212 42 42 43 43 void cm_log(const char* name, const char* log, ...) { 44 va_list args; 45 char namebuf[LOGNAME_LENGTH + 1]; 46 int i; 47 char* result; 48 char cbuf[2]; 44 49 if(!cm_do_log) return; 45 va_list args;46 50 va_start(args, log); 47 char namebuf[LOGNAME_LENGTH + 1];48 51 memset(namebuf, '.', LOGNAME_LENGTH); 49 52 namebuf[LOGNAME_LENGTH] = 0; 50 int i;51 53 for(i = 0; name[i] != 0 && i < LOGNAME_LENGTH; i++) { 52 54 namebuf[i] = name[i]; 53 55 } 54 56 55 char*result = malloc(1);57 result = malloc(1); 56 58 result[0] = 0; 57 59 58 char cbuf[2];59 60 cbuf[1] = 0; 60 61 … … 70 71 int a = va_arg(args, int); 71 72 char buf[128]; 73 char* tmp = result; 72 74 sprintf(buf, "%d", a); 73 char* tmp = result;74 75 result = cm_strcat(tmp, buf); 75 76 free(tmp); 76 77 } 77 78 } else { 79 char* tmp = result; 78 80 cbuf[0] = log[i]; 79 char* tmp = result;80 81 result = cm_strcat(tmp, cbuf); 81 82 free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.