Browse Source

Adding missing arguments to search functions

Yann Weber 7 years ago
parent
commit
533bb6b52e

+ 4
- 2
src/include/ttail_search.h View File

@@ -44,15 +44,17 @@ union _ttail_search_u
44 44
 
45 45
 /**@brief Begin a search session placing it in a ready to print situation
46 46
  *@param ttail_t*
47
+ *@param struct tm* tmin
47 48
  *@return 0 if ok -1 if fatal error 1 if not found
48 49
  */
49
-int ttail_search_closest(ttail_t*);
50
+int ttail_search_closest(ttail_t*, const struct tm*);
50 51
 
51 52
 /**@brief @ref ttail_search_closest() implementation for stdin
52 53
  *@param ttail_t*
54
+ *@param struct tm* tmin
53 55
  *@return 0 if ok -1 if fatal error 1 if not found
54 56
  */
55
-int _ttail_search_closest_stdin(ttail_t*);
57
+int _ttail_search_closest_stdin(ttail_t*, const struct tm*);
56 58
 
57 59
 /**@brief Loglines comparison function
58 60
  *@param ttail_t* ttail

+ 2
- 1
src/include/ttail_search_files.h View File

@@ -64,9 +64,10 @@ struct _ttail_search_file_s
64 64
  *
65 65
  *Will set struct _ttail_search_file_s.id and struct _ttail_search_file_s.off
66 66
  *@param ttail_t*
67
+ *@param tm struct tm* target time
67 68
  *@return 0 if ok -1 if fatal error 1 if not found
68 69
  */
69
-int _ttail_search_closest_files(ttail_t*);
70
+int _ttail_search_closest_files(ttail_t*, const struct tm*);
70 71
 int _ttail_search_closest_files_init(ttail_t*);
71 72
 int _ttail_search_closest_files_set_fsizes(ttail_t*);
72 73
 

+ 4
- 4
src/ttail_search.c View File

@@ -1,6 +1,6 @@
1 1
 #include "ttail_search.h"
2 2
 
3
-int ttail_search_closest(ttail_t* ttail)
3
+int ttail_search_closest(ttail_t* ttail, const struct tm *tm)
4 4
 {
5 5
 	if(ttail->session != NULL)
6 6
 	{
@@ -17,11 +17,11 @@ int ttail_search_closest(ttail_t* ttail)
17 17
 	}
18 18
 	*/
19 19
 	return ttail->logfile_sz?\
20
-		_ttail_search_closest_files(ttail):\
21
-		_ttail_search_closest_stdin(ttail);
20
+		_ttail_search_closest_files(ttail, tm):\
21
+		_ttail_search_closest_stdin(ttail, tm);
22 22
 }
23 23
 
24
-int _ttail_search_closest_stdin(ttail_t* t)
24
+int _ttail_search_closest_stdin(ttail_t* t, const struct tm* tm)
25 25
 {
26 26
 	return 0;
27 27
 }

+ 1
- 1
src/ttail_search_files.c View File

@@ -1,6 +1,6 @@
1 1
 #include "ttail_search_files.h"
2 2
 
3
-int _ttail_search_closest_files(ttail_t* t)
3
+int _ttail_search_closest_files(ttail_t* t, const struct tm *tm)
4 4
 {
5 5
 	int ret;
6 6
 	size_t i, prev;

+ 3
- 1
tests/ttail_search_check.c View File

@@ -309,6 +309,8 @@ START_TEST (test_search_files1)
309 309
 {
310 310
 	int ret;
311 311
 	size_t i;
312
+	struct tm tm;
313
+	memset(&tm, 0, sizeof(tm));
312 314
 	for(i=1;i<ttail->logfile_sz;i++)
313 315
 	{
314 316
 		fclose(ttail->logfile[i]);
@@ -318,7 +320,7 @@ START_TEST (test_search_files1)
318 320
 	ttail->prefix_sz = 0;
319 321
 	ttail_set_fmt(ttail, "%B%n%d %H:%M");
320 322
 
321
-	ret = _ttail_search_closest_files(ttail);
323
+	ret = _ttail_search_closest_files(ttail, &tm);
322 324
 	ck_assert_int_eq(ret, 0);
323 325
 	ck_assert(ttail->session->file.id == 0);
324 326
 }

Loading…
Cancel
Save