Explorar el Código

kconfig: make rand{,package}config fair

Give each boolean symbol a 50% chance of getting enabled, rather than 67%.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Peter Korsgaard hace 15 años
padre
commit
7705e6e415
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      package/config/confdata.c

+ 2 - 1
package/config/confdata.c

@@ -864,7 +864,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
 				sym->def[S_DEF_USER].tri = no;
 				break;
 			case def_random:
-				sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+				cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+				sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
 				break;
 			default:
 				continue;