Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent
Commits
aff6b28c
Commit
aff6b28c
authored
Apr 03, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of an obsolete function in format.c
parent
e3d2d69a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
71 deletions
+1
-71
format.c
src/format.c
+0
-19
format.h
src/format.h
+0
-1
test_format.c
src/test/test_format.c
+1
-51
No files found.
src/format.c
View file @
aff6b28c
...
...
@@ -184,25 +184,6 @@ get_rec_fld(logline_t *rec, int n)
return
get_fld
(
get_payload
(
rec
),
n
);
}
double
get_tm
(
tx_t
*
tx
)
{
char
*
ts
,
*
epochstr
;
double
epocht
=
0
;
CHECK_OBJ_NOTNULL
(
tx
,
TX_MAGIC
);
ts
=
get_hdr
(
tx
,
SLT_Timestamp
,
"Start"
);
if
(
ts
!=
NULL
&&
(
epochstr
=
get_fld
(
ts
,
0
))
!=
NULL
)
{
char
*
p
;
epocht
=
strtod
(
epochstr
,
&
p
);
}
if
(
epocht
==
0
)
epocht
=
tx
->
t
;
return
epocht
;
}
static
inline
void
format
(
tx_t
*
tx
,
enum
VSL_tag_e
tag
,
char
**
s
,
size_t
*
len
)
{
...
...
src/format.h
View file @
aff6b28c
...
...
@@ -42,7 +42,6 @@ logline_t *get_tag(tx_t *tx, enum VSL_tag_e tag);
char
*
get_hdr
(
tx_t
*
tx
,
enum
VSL_tag_e
tag
,
const
char
*
hdr
);
char
*
get_fld
(
const
char
*
str
,
int
n
);
char
*
get_rec_fld
(
logline_t
*
rec
,
int
n
);
double
get_tm
(
tx_t
*
tx
);
formatter_f
format_b_client
;
formatter_f
format_b_backend
;
...
...
src/test/test_format.c
View file @
aff6b28c
...
...
@@ -338,56 +338,6 @@ static const char
return
NULL
;
}
static
const
char
*
test_format_get_tm
(
void
)
{
#define T1 "Start: 1427743146.529143 0.000000 0.000000"
#define TIME 1427743146.529306
#define TX_TIME 1427744284.563984
tx_t
tx
;
logline_t
recs
[
NRECORDS
];
chunk_t
c
[
NRECORDS
];
double
tm
;
printf
(
"... testing get_tm()
\n
"
);
tx
.
magic
=
TX_MAGIC
;
tx
.
t
=
TX_TIME
;
VSTAILQ_INIT
(
&
tx
.
lines
);
for
(
int
i
=
0
;
i
<
NRECORDS
;
i
++
)
{
recs
[
i
].
magic
=
LOGLINE_MAGIC
;
recs
[
i
].
tag
=
SLT_ReqHeader
;
recs
[
i
].
len
=
strlen
(
"Bar: baz"
);
VSTAILQ_INSERT_TAIL
(
&
tx
.
lines
,
&
recs
[
i
],
linelist
);
VSTAILQ_INIT
(
&
recs
[
i
].
chunks
);
c
[
i
].
magic
=
CHUNK_MAGIC
;
c
[
i
].
data
=
(
char
*
)
calloc
(
1
,
config
.
chunk_size
);
strcpy
(
c
[
i
].
data
,
"Bar: baz"
);
VSTAILQ_INSERT_TAIL
(
&
recs
[
i
].
chunks
,
&
c
[
i
],
chunklist
);
}
recs
[
NRECORDS
/
2
].
tag
=
SLT_Timestamp
;
recs
[
NRECORDS
/
2
].
len
=
strlen
(
T1
);
strcpy
(
c
[
NRECORDS
/
2
].
data
,
T1
);
recs
[
NRECORDS
-
1
].
tag
=
SLT_Timestamp
;
sprintf
(
c
[
NRECORDS
-
1
].
data
,
"Start: %.6f 0.000000 0.000000"
,
TIME
);
recs
[
NRECORDS
-
1
].
len
=
strlen
(
c
[
NRECORDS
-
1
].
data
);
tm
=
get_tm
(
&
tx
);
MASSERT
(
fabs
(
tm
-
TIME
)
<
1e-6
);
/* Start timestamp not found, use the tx timestamp */
recs
[
NRECORDS
/
2
].
tag
=
SLT_ReqHeader
;
recs
[
NRECORDS
-
1
].
tag
=
SLT_ReqHeader
;
tm
=
get_tm
(
&
tx
);
MASSERT
(
fabs
(
tm
-
TX_TIME
)
<
1e-6
);
/* Empty line list */
VSTAILQ_INIT
(
&
tx
.
lines
);
tm
=
get_tm
(
&
tx
);
MASSERT
(
fabs
(
tm
-
TX_TIME
)
<
1e-6
);
return
NULL
;
}
static
const
char
*
test_format_H
(
void
)
{
...
...
@@ -808,6 +758,7 @@ static const char
init_tx_rec_chunk
(
&
tx
,
&
rec
,
&
chunk
);
MAN
(
chunk
.
data
);
#define T1 "Start: 1427743146.529143 0.000000 0.000000"
set_record_data
(
&
rec
,
&
chunk
,
T1
,
SLT_Timestamp
);
tm
=
localtime
(
&
t
);
MAN
(
strftime
(
strftime_s
,
config
.
max_reclen
,
fmt
,
tm
));
...
...
@@ -1271,7 +1222,6 @@ static const char
mu_run_test
(
test_format_get_hdr
);
mu_run_test
(
test_format_get_fld
);
mu_run_test
(
test_format_get_rec_fld
);
mu_run_test
(
test_format_get_tm
);
mu_run_test
(
test_format_b
);
mu_run_test
(
test_format_D
);
mu_run_test
(
test_format_H
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment