calendar

BSD calendar reimplementation
git clone https://git.ce9e.org/calendar.git

commit
ba88811233a4cf28432ca3b89aa47b1670b3198c
parent
c5aa628324ef96b05cf5d63ee0bfca881d720b5a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-01-30 06:09
use void on functions without parameters

Diffstat

M calendar.c 4 ++--
M test.c 54 +++++++++++++++++++++++++++---------------------------

2 files changed, 29 insertions, 29 deletions


diff --git a/calendar.c b/calendar.c

@@ -76,7 +76,7 @@ struct tm mkdate(int year, int month, int day) {
   76    76 	return tm;
   77    77 }
   78    78 
   79    -1 struct tpl mktpl() {
   -1    79 struct tpl mktpl(void) {
   80    80 	struct tpl tpl = {
   81    81 		.year=0,
   82    82 		.month=0,
@@ -92,7 +92,7 @@ struct tpl mktpl() {
   92    92 	return tpl;
   93    93 }
   94    94 
   95    -1 struct tm *today() {
   -1    95 struct tm *today(void) {
   96    96 	time_t t = time(NULL);
   97    97 	return localtime(&t);
   98    98 }

diff --git a/test.c b/test.c

@@ -8,7 +8,7 @@
    8     8 int tests_run = 0;
    9     9 int tests_failed = 0;
   10    10 
   11    -1 static char *test_easter() {
   -1    11 static char *test_easter(void) {
   12    12 	mu_assert("2000", date_comp(easter(2000, false), mkdate(2000, 4, 23)));
   13    13 	mu_assert("2001", date_comp(easter(2001, false), mkdate(2001, 4, 15)));
   14    14 	mu_assert("2002", date_comp(easter(2002, false), mkdate(2002, 3, 31)));
@@ -43,7 +43,7 @@ static char *test_easter() {
   43    43 	return 0;
   44    44 }
   45    45 
   46    -1 static char *test_paskha() {
   -1    46 static char *test_paskha(void) {
   47    47 	mu_assert("2000", date_comp(easter(2000, true), mkdate(2000, 4, 30)));
   48    48 	mu_assert("2001", date_comp(easter(2001, true), mkdate(2001, 4, 15)));
   49    49 	mu_assert("2002", date_comp(easter(2002, true), mkdate(2002, 5,  5)));
@@ -98,7 +98,7 @@ struct tpl parse_date_mut(const char *s) {
   98    98 	return tpl;
   99    99 }
  100   100 
  101    -1 char *test_parse_date_dd() {
   -1   101 char *test_parse_date_dd(void) {
  102   102 	struct tpl actual = parse_date_mut("13");
  103   103 	struct tpl expected = mktpl();
  104   104 	expected.year = today()->tm_year + 1900;
@@ -108,7 +108,7 @@ char *test_parse_date_dd() {
  108   108 	return 0;
  109   109 }
  110   110 
  111    -1 char *test_parse_date_dd_star() {
   -1   111 char *test_parse_date_dd_star(void) {
  112   112 	struct tpl actual = parse_date_mut("13*");
  113   113 	struct tpl expected = mktpl();
  114   114 	expected.day = 13;
@@ -117,7 +117,7 @@ char *test_parse_date_dd_star() {
  117   117 	return 0;
  118   118 }
  119   119 
  120    -1 char *test_parse_date_mmdd() {
   -1   120 char *test_parse_date_mmdd(void) {
  121   121 	struct tpl actual = parse_date_mut("02/13");
  122   122 	struct tpl expected = mktpl();
  123   123 	expected.year = today()->tm_year + 1900 + (today()->tm_mon + 1 > 2 ? 1 : 0);
@@ -128,7 +128,7 @@ char *test_parse_date_mmdd() {
  128   128 	return 0;
  129   129 }
  130   130 
  131    -1 char *test_parse_date_mmdd_star() {
   -1   131 char *test_parse_date_mmdd_star(void) {
  132   132 	struct tpl actual = parse_date_mut("02/13*");
  133   133 	struct tpl expected = mktpl();
  134   134 	expected.month = 2;
@@ -138,7 +138,7 @@ char *test_parse_date_mmdd_star() {
  138   138 	return 0;
  139   139 }
  140   140 
  141    -1 char *test_parse_date_yyyymmdd() {
   -1   141 char *test_parse_date_yyyymmdd(void) {
  142   142 	struct tpl actual = parse_date_mut("1999/02/13");
  143   143 	struct tpl expected = mktpl();
  144   144 	expected.year = 1999;
@@ -149,7 +149,7 @@ char *test_parse_date_yyyymmdd() {
  149   149 	return 0;
  150   150 }
  151   151 
  152    -1 char *test_parse_date_yyyymmdd_star() {
   -1   152 char *test_parse_date_yyyymmdd_star(void) {
  153   153 	struct tpl actual = parse_date_mut("1999/02/13*");
  154   154 	struct tpl expected = mktpl();
  155   155 	expected.month = 2;
@@ -159,7 +159,7 @@ char *test_parse_date_yyyymmdd_star() {
  159   159 	return 0;
  160   160 }
  161   161 
  162    -1 char *test_parse_date_yyyymmdd_repeat() {
   -1   162 char *test_parse_date_yyyymmdd_repeat(void) {
  163   163 	struct tpl actual = parse_date_mut("1999/02/13+2");
  164   164 	struct tpl expected = mktpl();
  165   165 	expected.year = 1999;
@@ -171,7 +171,7 @@ char *test_parse_date_yyyymmdd_repeat() {
  171   171 	return 0;
  172   172 }
  173   173 
  174    -1 char *test_parse_date_weekday() {
   -1   174 char *test_parse_date_weekday(void) {
  175   175 	struct tpl actual = parse_date_mut("Sat");
  176   176 	struct tpl expected = mktpl();
  177   177 	expected.weekday = 7;
@@ -180,7 +180,7 @@ char *test_parse_date_weekday() {
  180   180 	return 0;
  181   181 }
  182   182 
  183    -1 char *test_parse_date_weekday_with_nth_of_month() {
   -1   183 char *test_parse_date_weekday_with_nth_of_month(void) {
  184   184 	struct tpl actual = parse_date_mut("Sat-1");
  185   185 	struct tpl expected = mktpl();
  186   186 	expected.weekday = 7;
@@ -190,7 +190,7 @@ char *test_parse_date_weekday_with_nth_of_month() {
  190   190 	return 0;
  191   191 }
  192   192 
  193    -1 char *test_parse_date_mm_weekday() {
   -1   193 char *test_parse_date_mm_weekday(void) {
  194   194 	struct tpl actual = parse_date_mut("02/Sat+2");
  195   195 	struct tpl expected = mktpl();
  196   196 	expected.month = 2;
@@ -201,7 +201,7 @@ char *test_parse_date_mm_weekday() {
  201   201 	return 0;
  202   202 }
  203   203 
  204    -1 char *test_parse_date_yyyymm_weekday() {
   -1   204 char *test_parse_date_yyyymm_weekday(void) {
  205   205 	struct tpl actual = parse_date_mut("1999/02/Sat+2");
  206   206 	struct tpl expected = mktpl();
  207   207 	expected.year = 1999;
@@ -213,7 +213,7 @@ char *test_parse_date_yyyymm_weekday() {
  213   213 	return 0;
  214   214 }
  215   215 
  216    -1 char *test_parse_date_easter() {
   -1   216 char *test_parse_date_easter(void) {
  217   217 	struct tpl actual = parse_date_mut("Easter");
  218   218 	struct tpl expected = mktpl();
  219   219 	expected.from_easter = 0;
@@ -222,7 +222,7 @@ char *test_parse_date_easter() {
  222   222 	return 0;
  223   223 }
  224   224 
  225    -1 char *test_parse_date_easter_with_offset() {
   -1   225 char *test_parse_date_easter_with_offset(void) {
  226   226 	struct tpl actual = parse_date_mut("Easter+30");
  227   227 	struct tpl expected = mktpl();
  228   228 	expected.from_easter = 30;
@@ -231,7 +231,7 @@ char *test_parse_date_easter_with_offset() {
  231   231 	return 0;
  232   232 }
  233   233 
  234    -1 char *test_is_match_dd() {
   -1   234 char *test_is_match_dd(void) {
  235   235 	struct tpl tpl = mktpl();
  236   236 	tpl.day = 13;
  237   237 
@@ -240,7 +240,7 @@ char *test_is_match_dd() {
  240   240 	return 0;
  241   241 }
  242   242 
  243    -1 char *test_is_match_mmdd() {
   -1   243 char *test_is_match_mmdd(void) {
  244   244 	struct tpl tpl = mktpl();
  245   245 	tpl.month = 2;
  246   246 	tpl.day = 13;
@@ -251,7 +251,7 @@ char *test_is_match_mmdd() {
  251   251 	return 0;
  252   252 }
  253   253 
  254    -1 char *test_is_match_yyyymmdd() {
   -1   254 char *test_is_match_yyyymmdd(void) {
  255   255 	struct tpl tpl = mktpl();
  256   256 	tpl.year = 1999;
  257   257 	tpl.month = 2;
@@ -264,7 +264,7 @@ char *test_is_match_yyyymmdd() {
  264   264 	return 0;
  265   265 }
  266   266 
  267    -1 char *test_is_match_yyyymmdd_repeat() {
   -1   267 char *test_is_match_yyyymmdd_repeat(void) {
  268   268 	struct tpl tpl = mktpl();
  269   269 	tpl.year = 1999;
  270   270 	tpl.month = 2;
@@ -278,7 +278,7 @@ char *test_is_match_yyyymmdd_repeat() {
  278   278 	return 0;
  279   279 }
  280   280 
  281    -1 char *test_is_match_weekday() {
   -1   281 char *test_is_match_weekday(void) {
  282   282 	struct tpl tpl = mktpl();
  283   283 	tpl.weekday = 7;
  284   284 
@@ -287,7 +287,7 @@ char *test_is_match_weekday() {
  287   287 	return 0;
  288   288 }
  289   289 
  290    -1 char *test_is_match_weekday_with_nth_of_month() {
   -1   290 char *test_is_match_weekday_with_nth_of_month(void) {
  291   291 	struct tpl tpl = mktpl();
  292   292 	tpl.weekday = 7;
  293   293 	tpl.nth_of_month = 2;
@@ -298,7 +298,7 @@ char *test_is_match_weekday_with_nth_of_month() {
  298   298 	return 0;
  299   299 }
  300   300 
  301    -1 char *test_is_match_mm_weekday() {
   -1   301 char *test_is_match_mm_weekday(void) {
  302   302 	struct tpl tpl = mktpl();
  303   303 	tpl.month = 2;
  304   304 	tpl.weekday = 7;
@@ -311,7 +311,7 @@ char *test_is_match_mm_weekday() {
  311   311 	return 0;
  312   312 }
  313   313 
  314    -1 char *test_is_match_yyyymm_weekday() {
   -1   314 char *test_is_match_yyyymm_weekday(void) {
  315   315 	struct tpl tpl = mktpl();
  316   316 	tpl.year = 1999;
  317   317 	tpl.month = 2;
@@ -326,7 +326,7 @@ char *test_is_match_yyyymm_weekday() {
  326   326 	return 0;
  327   327 }
  328   328 
  329    -1 char *test_is_match_easter() {
   -1   329 char *test_is_match_easter(void) {
  330   330 	struct tpl tpl = mktpl();
  331   331 	tpl.from_easter = 0;
  332   332 	tpl.easter = true;
@@ -336,7 +336,7 @@ char *test_is_match_easter() {
  336   336 	return 0;
  337   337 }
  338   338 
  339    -1 char *test_is_match_easter_with_offset() {
   -1   339 char *test_is_match_easter_with_offset(void) {
  340   340 	struct tpl tpl = mktpl();
  341   341 	tpl.from_easter = 2;
  342   342 	tpl.easter = true;
@@ -346,7 +346,7 @@ char *test_is_match_easter_with_offset() {
  346   346 	return 0;
  347   347 }
  348   348 
  349    -1 char *test_is_match_paskha() {
   -1   349 char *test_is_match_paskha(void) {
  350   350 	struct tpl tpl = mktpl();
  351   351 	tpl.from_paskha = 0;
  352   352 	tpl.paskha = true;
@@ -356,7 +356,7 @@ char *test_is_match_paskha() {
  356   356 	return 0;
  357   357 }
  358   358 
  359    -1 char *test_is_match_paskha_with_offset() {
   -1   359 char *test_is_match_paskha_with_offset(void) {
  360   360 	struct tpl tpl = mktpl();
  361   361 	tpl.from_paskha = -2;
  362   362 	tpl.paskha = true;