Commits

Sebastian Freundt committed d6df7b8

minor, split up strpt_s' component_set field into h_set, m_set, etc.

Signed-off-by: Sebastian Freundt <freundt@ga-group.nl>

Comments (0)

Files changed (3)

lib/time-core-strpf.c

 	/* check if components got set */
 	switch (s.spfl) {
 	case DT_SPFL_N_TSTD:
+		d->flags.h_set = 1;
+		d->flags.m_set = 1;
+		d->flags.s_set = 1;
+		break;
 	case DT_SPFL_N_HOUR:
+		d->flags.h_set = 1;
+		break;
 	case DT_SPFL_N_MIN:
+		d->flags.m_set = 1;
+		break;
 	case DT_SPFL_N_SEC:
+		d->flags.s_set = 1;
+		break;
 	case DT_SPFL_N_NANO:
-		d->flags.component_set = 1;
+		d->flags.ns_set = 1;
+		break;
 	default:
 		break;
 	}

lib/time-core-strpf.h

 		struct {
 			/* 0 for am, 1 for pm */
 			unsigned int am_pm_bit:1;
-			/* 0 if no component has been set, 1 otherwise */
-			unsigned int component_set:1;
+
+			unsigned int h_set:1;
+			unsigned int m_set:1;
+			unsigned int s_set:1;
+			unsigned int ns_set:1;
 		};
 	} flags;
 };
 {
 	struct dt_t_s res;
 
-	if (UNLIKELY(!t.flags.component_set)) {
+	if (UNLIKELY(!(t.flags.h_set || t.flags.m_set ||
+		       t.flags.s_set || t.flags.ns_set))) {
 		goto fucked;
 	}
 	if (UNLIKELY(t.h < 0)) {