summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4db3104)
Macro TW_SNIL was the zero value for a two-bit field. It was only used
once, and that is better ordered to check for bits set with none set
being the last, else, case, rather than in the middle. Kept the
behaviour of undefined value 3 being treated as TW_SIMP, 2.
#define TW_NULL 0x0000
#define TW_SDAY 0x0003 /* how day-of-week was determined */
#define TW_NULL 0x0000
#define TW_SDAY 0x0003 /* how day-of-week was determined */
-#define TW_SNIL 0x0000 /* not given */
#define TW_SEXP 0x0001 /* explicitly given */
#define TW_SIMP 0x0002 /* implicitly given */
#define TW_SEXP 0x0001 /* explicitly given */
#define TW_SIMP 0x0002 /* implicitly given */
{
char buffer[80];
static char result[80];
{
char buffer[80];
static char result[80];
tw->tw_year < 100 ? 2 : 4, tw->tw_year,
tw->tw_hour, tw->tw_min, tw->tw_sec, result);
tw->tw_year < 100 ? 2 : 4, tw->tw_year,
tw->tw_hour, tw->tw_min, tw->tw_sec, result);
- if ((tw->tw_flags & TW_SDAY) == TW_SEXP)
- snprintf (result, sizeof(result), "%s, %s", tw_dotw[tw->tw_wday], buffer);
- else
- if ((tw->tw_flags & TW_SDAY) == TW_SNIL)
- strncpy (result, buffer, sizeof(result));
- else
- snprintf (result, sizeof(result), "%s (%s)", buffer, tw_dotw[tw->tw_wday]);
+ if ((twf = tw->tw_flags & TW_SDAY)) {
+ if (twf == TW_SEXP)
+ snprintf(result, sizeof(result), "%s, %s", tw_dotw[tw->tw_wday], buffer);
+ else
+ snprintf(result, sizeof(result), "%s (%s)", buffer, tw_dotw[tw->tw_wday]);
+ } else
+ strncpy(result, buffer, sizeof(result));