id to index

connection_manager
yuqing 2018-06-26 10:57:48 +08:00
parent 3c06e33be8
commit b27ecc4c1e
1 changed files with 7 additions and 7 deletions

View File

@ -472,29 +472,29 @@ int sf_startup_schedule(pthread_t *schedule_tid)
ScheduleArray scheduleArray; ScheduleArray scheduleArray;
ScheduleEntry scheduleEntries[SCHEDULE_ENTRIES_COUNT]; ScheduleEntry scheduleEntries[SCHEDULE_ENTRIES_COUNT];
int id; int index;
scheduleArray.entries = scheduleEntries; scheduleArray.entries = scheduleEntries;
scheduleArray.count = 0; scheduleArray.count = 0;
memset(scheduleEntries, 0, sizeof(scheduleEntries)); memset(scheduleEntries, 0, sizeof(scheduleEntries));
id = scheduleArray.count++; index = scheduleArray.count++;
INIT_SCHEDULE_ENTRY(scheduleEntries[id], id, TIME_NONE, TIME_NONE, 0, INIT_SCHEDULE_ENTRY(scheduleEntries[index], index + 1, TIME_NONE, TIME_NONE, 0,
g_sf_global_vars.sync_log_buff_interval, log_sync_func, &g_log_context); g_sf_global_vars.sync_log_buff_interval, log_sync_func, &g_log_context);
if (g_sf_global_vars.rotate_error_log) { if (g_sf_global_vars.rotate_error_log) {
log_set_rotate_time_format(&g_log_context, "%Y%m%d"); log_set_rotate_time_format(&g_log_context, "%Y%m%d");
id = scheduleArray.count++; index = scheduleArray.count++;
INIT_SCHEDULE_ENTRY(scheduleEntries[id], id, 0, 0, 0, INIT_SCHEDULE_ENTRY(scheduleEntries[index], index + 1, 0, 0, 0,
86400, log_notify_rotate, &g_log_context); 86400, log_notify_rotate, &g_log_context);
if (g_sf_global_vars.log_file_keep_days > 0) { if (g_sf_global_vars.log_file_keep_days > 0) {
log_set_keep_days(&g_log_context, g_sf_global_vars.log_file_keep_days); log_set_keep_days(&g_log_context, g_sf_global_vars.log_file_keep_days);
id = scheduleArray.count++; index = scheduleArray.count++;
INIT_SCHEDULE_ENTRY(scheduleEntries[id], id, 1, 0, 0, INIT_SCHEDULE_ENTRY(scheduleEntries[index], index + 1, 1, 0, 0,
86400, log_delete_old_files, &g_log_context); 86400, log_delete_old_files, &g_log_context);
} }
} }