projects
/
platform
/
upstream
/
libxkbcommon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compose.c: fix untrusted source issue
[platform/upstream/libxkbcommon.git]
/
bench
/
compose.c
diff --git
a/bench/compose.c
b/bench/compose.c
index
e2bf3e0
..
4198e32
100644
(file)
--- a/
bench/compose.c
+++ b/
bench/compose.c
@@
-21,6
+21,8
@@
* DEALINGS IN THE SOFTWARE.
*/
* DEALINGS IN THE SOFTWARE.
*/
+#include "config.h"
+
#include <time.h>
#include "xkbcommon/xkbcommon-compose.h"
#include <time.h>
#include "xkbcommon/xkbcommon-compose.h"
@@
-37,14
+39,14
@@
main(void)
char *path;
FILE *file;
struct xkb_compose_table *table;
char *path;
FILE *file;
struct xkb_compose_table *table;
- struct bench
_timer timer
;
+ struct bench
bench
;
char *elapsed;
ctx = test_get_context(CONTEXT_NO_FLAG);
assert(ctx);
char *elapsed;
ctx = test_get_context(CONTEXT_NO_FLAG);
assert(ctx);
- path = test_get_path("
compos
e/en_US.UTF-8/Compose");
- file = fopen(path, "r");
+ path = test_get_path("
local
e/en_US.UTF-8/Compose");
+ file = fopen(path, "r
b
");
if (file == NULL) {
perror(path);
free(path);
if (file == NULL) {
perror(path);
free(path);
@@
-55,9
+57,7
@@
main(void)
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0);
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0);
- bench_timer_reset(&timer);
-
- bench_timer_start(&timer);
+ bench_start(&bench);
for (int i = 0; i < BENCHMARK_ITERATIONS; i++) {
rewind(file);
table = xkb_compose_table_new_from_file(ctx, file, "",
for (int i = 0; i < BENCHMARK_ITERATIONS; i++) {
rewind(file);
table = xkb_compose_table_new_from_file(ctx, file, "",
@@
-66,12
+66,12
@@
main(void)
assert(table);
xkb_compose_table_unref(table);
}
assert(table);
xkb_compose_table_unref(table);
}
- bench_
timer_stop(&timer
);
+ bench_
stop(&bench
);
fclose(file);
free(path);
fclose(file);
free(path);
- elapsed = bench_
timer_get_elapsed_time_str(&timer
);
+ elapsed = bench_
elapsed_str(&bench
);
fprintf(stderr, "compiled %d compose tables in %ss\n",
BENCHMARK_ITERATIONS, elapsed);
free(elapsed);
fprintf(stderr, "compiled %d compose tables in %ss\n",
BENCHMARK_ITERATIONS, elapsed);
free(elapsed);