직장인의 인생 코딩.
버그 있으면 알려주세요..
/************************************
* What is happy life? hired or fired? *
************************************/
int work_day( int day ) {
int ret;
int delay_count = 0;
const int second_unit = 60;
Me me = Me.create(); // 'me' means you !! uh~hhhhhhh
if ( is_holiday() ) {
me.free(); // found memory leak bug by maenani
return RET_GOOD;
}
while ( me.is_sleep ) {
ret = me.wakeup();
if ( ret == RET_FAIL ) {
set_alarm( now() + convert_time( second_unit * 5 ) ) ; // after 5 minute
delay_count++;
} else ( ret == RET_OK ) {
me.is_sleep = false;
}
}
if ( delay_count > CONST_LATE_DEADLINE ) {
if ( late_count( me ) > CONST_LATE_ALLOW_LIMIT ) {
me.job_state = CONST_STATE_FIRED;
me.free();
return RET_SO_BAD;
}
}
if ( me.job_state == CONST_STATE_HIRED ) {
me.going_office = CONST_SET;
walk( me );
bus( me );
subway( me , CONST_SUBWAY_LINE_5 );
subway( me , CONST_SUBWAY_LINE_2 );
subway( me , CONST_SUBWAY_LINE_7 );
walk( me );
me.going_office = CONST_UNSET;
while ( me.can_go_home() != true ) {
me.work();
sick_and_tired( me );
me.boring();
}
me.going_home = CONST_SET;
walk( me );
subway( me , CONST_SUBWAY_LINE_7 );
subway( me , CONST_SUBWAY_LINE_2 );
subway( me , CONST_SUBWAY_LINE_5 );
bus( me );
walk( me );
me.going_home = CONST_UNSET;
}
me.do_wash();
me.free(); // Thanks GOD !
return RET_BAD;
}
버그 있으면 알려주세요..
/************************************
* What is happy life? hired or fired? *
************************************/
int work_day( int day ) {
int ret;
int delay_count = 0;
const int second_unit = 60;
Me me = Me.create(); // 'me' means you !! uh~hhhhhhh
if ( is_holiday() ) {
me.free(); // found memory leak bug by maenani
return RET_GOOD;
}
while ( me.is_sleep ) {
ret = me.wakeup();
if ( ret == RET_FAIL ) {
set_alarm( now() + convert_time( second_unit * 5 ) ) ; // after 5 minute
delay_count++;
} else ( ret == RET_OK ) {
me.is_sleep = false;
}
}
if ( delay_count > CONST_LATE_DEADLINE ) {
if ( late_count( me ) > CONST_LATE_ALLOW_LIMIT ) {
me.job_state = CONST_STATE_FIRED;
me.free();
return RET_SO_BAD;
}
}
if ( me.job_state == CONST_STATE_HIRED ) {
me.going_office = CONST_SET;
walk( me );
bus( me );
subway( me , CONST_SUBWAY_LINE_5 );
subway( me , CONST_SUBWAY_LINE_2 );
subway( me , CONST_SUBWAY_LINE_7 );
walk( me );
me.going_office = CONST_UNSET;
while ( me.can_go_home() != true ) {
me.work();
sick_and_tired( me );
me.boring();
}
me.going_home = CONST_SET;
walk( me );
subway( me , CONST_SUBWAY_LINE_7 );
subway( me , CONST_SUBWAY_LINE_2 );
subway( me , CONST_SUBWAY_LINE_5 );
bus( me );
walk( me );
me.going_home = CONST_UNSET;
}
me.do_wash();
me.free(); // Thanks GOD !
return RET_BAD;
}