diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2009-10-14 15:43:44 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-10-15 04:43:17 -0400 |
| commit | c4dc775f53136cd6af8f88bce67cce9b42751768 (patch) | |
| tree | 8c5f99e1396b8dfa427b1143d71b47d15ffa0610 /tools/perf/util/trace-event-parse.c | |
| parent | afdf1a404eed236d6f762ee44cc0f1dcc97206e0 (diff) | |
perf tools: Remove all char * typecasts and use const in prototype
The (char *) for all the static strings was a fix for the
symptom and not the disease. The real issue was that the
function prototypes needed to be declared "const char *".
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20091014194400.635935008@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
| -rw-r--r-- | tools/perf/util/trace-event-parse.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 2d424ff50ec2..4b61b497040e 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -685,10 +685,10 @@ static char *event_read_name(void) | |||
| 685 | { | 685 | { |
| 686 | char *token; | 686 | char *token; |
| 687 | 687 | ||
| 688 | if (read_expected(EVENT_ITEM, (char *)"name") < 0) | 688 | if (read_expected(EVENT_ITEM, "name") < 0) |
| 689 | return NULL; | 689 | return NULL; |
| 690 | 690 | ||
| 691 | if (read_expected(EVENT_OP, (char *)":") < 0) | 691 | if (read_expected(EVENT_OP, ":") < 0) |
| 692 | return NULL; | 692 | return NULL; |
| 693 | 693 | ||
| 694 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 694 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| @@ -706,10 +706,10 @@ static int event_read_id(void) | |||
| 706 | char *token; | 706 | char *token; |
| 707 | int id; | 707 | int id; |
| 708 | 708 | ||
| 709 | if (read_expected_item(EVENT_ITEM, (char *)"ID") < 0) | 709 | if (read_expected_item(EVENT_ITEM, "ID") < 0) |
| 710 | return -1; | 710 | return -1; |
| 711 | 711 | ||
| 712 | if (read_expected(EVENT_OP, (char *)":") < 0) | 712 | if (read_expected(EVENT_OP, ":") < 0) |
| 713 | return -1; | 713 | return -1; |
| 714 | 714 | ||
| 715 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 715 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| @@ -759,7 +759,7 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 759 | 759 | ||
| 760 | count++; | 760 | count++; |
| 761 | 761 | ||
| 762 | if (test_type_token(type, token, EVENT_ITEM, (char *)"field")) | 762 | if (test_type_token(type, token, EVENT_ITEM, "field")) |
| 763 | goto fail; | 763 | goto fail; |
| 764 | free_token(token); | 764 | free_token(token); |
| 765 | 765 | ||
| @@ -774,7 +774,7 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 774 | type = read_token(&token); | 774 | type = read_token(&token); |
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | if (test_type_token(type, token, EVENT_OP, (char *)":") < 0) | 777 | if (test_type_token(type, token, EVENT_OP, ":") < 0) |
| 778 | return -1; | 778 | return -1; |
| 779 | 779 | ||
| 780 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 780 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| @@ -892,14 +892,14 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 892 | field->flags |= FIELD_IS_DYNAMIC; | 892 | field->flags |= FIELD_IS_DYNAMIC; |
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | if (test_type_token(type, token, EVENT_OP, (char *)";")) | 895 | if (test_type_token(type, token, EVENT_OP, ";")) |
| 896 | goto fail; | 896 | goto fail; |
| 897 | free_token(token); | 897 | free_token(token); |
| 898 | 898 | ||
| 899 | if (read_expected(EVENT_ITEM, (char *)"offset") < 0) | 899 | if (read_expected(EVENT_ITEM, "offset") < 0) |
| 900 | goto fail_expect; | 900 | goto fail_expect; |
| 901 | 901 | ||
| 902 | if (read_expected(EVENT_OP, (char *)":") < 0) | 902 | if (read_expected(EVENT_OP, ":") < 0) |
| 903 | goto fail_expect; | 903 | goto fail_expect; |
| 904 | 904 | ||
| 905 | if (read_expect_type(EVENT_ITEM, &token)) | 905 | if (read_expect_type(EVENT_ITEM, &token)) |
| @@ -907,13 +907,13 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 907 | field->offset = strtoul(token, NULL, 0); | 907 | field->offset = strtoul(token, NULL, 0); |
| 908 | free_token(token); | 908 | free_token(token); |
| 909 | 909 | ||
| 910 | if (read_expected(EVENT_OP, (char *)";") < 0) | 910 | if (read_expected(EVENT_OP, ";") < 0) |
| 911 | goto fail_expect; | 911 | goto fail_expect; |
| 912 | 912 | ||
| 913 | if (read_expected(EVENT_ITEM, (char *)"size") < 0) | 913 | if (read_expected(EVENT_ITEM, "size") < 0) |
| 914 | goto fail_expect; | 914 | goto fail_expect; |
| 915 | 915 | ||
| 916 | if (read_expected(EVENT_OP, (char *)":") < 0) | 916 | if (read_expected(EVENT_OP, ":") < 0) |
| 917 | goto fail_expect; | 917 | goto fail_expect; |
| 918 | 918 | ||
| 919 | if (read_expect_type(EVENT_ITEM, &token)) | 919 | if (read_expect_type(EVENT_ITEM, &token)) |
| @@ -921,18 +921,18 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 921 | field->size = strtoul(token, NULL, 0); | 921 | field->size = strtoul(token, NULL, 0); |
| 922 | free_token(token); | 922 | free_token(token); |
| 923 | 923 | ||
| 924 | if (read_expected(EVENT_OP, (char *)";") < 0) | 924 | if (read_expected(EVENT_OP, ";") < 0) |
| 925 | goto fail_expect; | 925 | goto fail_expect; |
| 926 | 926 | ||
| 927 | type = read_token(&token); | 927 | type = read_token(&token); |
| 928 | if (type != EVENT_NEWLINE) { | 928 | if (type != EVENT_NEWLINE) { |
| 929 | /* newer versions of the kernel have a "signed" type */ | 929 | /* newer versions of the kernel have a "signed" type */ |
| 930 | if (test_type_token(type, token, EVENT_ITEM, (char *)"signed")) | 930 | if (test_type_token(type, token, EVENT_ITEM, "signed")) |
| 931 | goto fail; | 931 | goto fail; |
| 932 | 932 | ||
| 933 | free_token(token); | 933 | free_token(token); |
| 934 | 934 | ||
| 935 | if (read_expected(EVENT_OP, (char *)":") < 0) | 935 | if (read_expected(EVENT_OP, ":") < 0) |
| 936 | goto fail_expect; | 936 | goto fail_expect; |
| 937 | 937 | ||
| 938 | if (read_expect_type(EVENT_ITEM, &token)) | 938 | if (read_expect_type(EVENT_ITEM, &token)) |
| @@ -941,7 +941,7 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 941 | /* add signed type */ | 941 | /* add signed type */ |
| 942 | 942 | ||
| 943 | free_token(token); | 943 | free_token(token); |
| 944 | if (read_expected(EVENT_OP, (char *)";") < 0) | 944 | if (read_expected(EVENT_OP, ";") < 0) |
| 945 | goto fail_expect; | 945 | goto fail_expect; |
| 946 | 946 | ||
| 947 | if (read_expect_type(EVENT_NEWLINE, &token)) | 947 | if (read_expect_type(EVENT_NEWLINE, &token)) |
| @@ -970,10 +970,10 @@ static int event_read_format(struct event *event) | |||
| 970 | char *token; | 970 | char *token; |
| 971 | int ret; | 971 | int ret; |
| 972 | 972 | ||
| 973 | if (read_expected_item(EVENT_ITEM, (char *)"format") < 0) | 973 | if (read_expected_item(EVENT_ITEM, "format") < 0) |
| 974 | return -1; | 974 | return -1; |
| 975 | 975 | ||
| 976 | if (read_expected(EVENT_OP, (char *)":") < 0) | 976 | if (read_expected(EVENT_OP, ":") < 0) |
| 977 | return -1; | 977 | return -1; |
| 978 | 978 | ||
| 979 | if (read_expect_type(EVENT_NEWLINE, &token)) | 979 | if (read_expect_type(EVENT_NEWLINE, &token)) |
| @@ -1033,7 +1033,7 @@ process_cond(struct event *event, struct print_arg *top, char **tok) | |||
| 1033 | 1033 | ||
| 1034 | *tok = NULL; | 1034 | *tok = NULL; |
| 1035 | type = process_arg(event, left, &token); | 1035 | type = process_arg(event, left, &token); |
| 1036 | if (test_type_token(type, token, EVENT_OP, (char *)":")) | 1036 | if (test_type_token(type, token, EVENT_OP, ":")) |
| 1037 | goto out_free; | 1037 | goto out_free; |
| 1038 | 1038 | ||
| 1039 | arg->op.op = token; | 1039 | arg->op.op = token; |
| @@ -1065,7 +1065,7 @@ process_array(struct event *event, struct print_arg *top, char **tok) | |||
| 1065 | 1065 | ||
| 1066 | *tok = NULL; | 1066 | *tok = NULL; |
| 1067 | type = process_arg(event, arg, &token); | 1067 | type = process_arg(event, arg, &token); |
| 1068 | if (test_type_token(type, token, EVENT_OP, (char *)"]")) | 1068 | if (test_type_token(type, token, EVENT_OP, "]")) |
| 1069 | goto out_free; | 1069 | goto out_free; |
| 1070 | 1070 | ||
| 1071 | top->op.right = arg; | 1071 | top->op.right = arg; |
| @@ -1287,7 +1287,7 @@ process_entry(struct event *event __unused, struct print_arg *arg, | |||
| 1287 | char *field; | 1287 | char *field; |
| 1288 | char *token; | 1288 | char *token; |
| 1289 | 1289 | ||
| 1290 | if (read_expected(EVENT_OP, (char *)"->") < 0) | 1290 | if (read_expected(EVENT_OP, "->") < 0) |
| 1291 | return EVENT_ERROR; | 1291 | return EVENT_ERROR; |
| 1292 | 1292 | ||
| 1293 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1293 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| @@ -1447,14 +1447,14 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
| 1447 | do { | 1447 | do { |
| 1448 | free_token(token); | 1448 | free_token(token); |
| 1449 | type = read_token_item(&token); | 1449 | type = read_token_item(&token); |
| 1450 | if (test_type_token(type, token, EVENT_OP, (char *)"{")) | 1450 | if (test_type_token(type, token, EVENT_OP, "{")) |
| 1451 | break; | 1451 | break; |
| 1452 | 1452 | ||
| 1453 | arg = malloc_or_die(sizeof(*arg)); | 1453 | arg = malloc_or_die(sizeof(*arg)); |
| 1454 | 1454 | ||
| 1455 | free_token(token); | 1455 | free_token(token); |
| 1456 | type = process_arg(event, arg, &token); | 1456 | type = process_arg(event, arg, &token); |
| 1457 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) | 1457 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1458 | goto out_free; | 1458 | goto out_free; |
| 1459 | 1459 | ||
| 1460 | field = malloc_or_die(sizeof(*field)); | 1460 | field = malloc_or_die(sizeof(*field)); |
| @@ -1465,7 +1465,7 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
| 1465 | 1465 | ||
| 1466 | free_token(token); | 1466 | free_token(token); |
| 1467 | type = process_arg(event, arg, &token); | 1467 | type = process_arg(event, arg, &token); |
| 1468 | if (test_type_token(type, token, EVENT_OP, (char *)"}")) | 1468 | if (test_type_token(type, token, EVENT_OP, "}")) |
| 1469 | goto out_free; | 1469 | goto out_free; |
| 1470 | 1470 | ||
| 1471 | value = arg_eval(arg); | 1471 | value = arg_eval(arg); |
| @@ -1500,13 +1500,13 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
| 1500 | memset(arg, 0, sizeof(*arg)); | 1500 | memset(arg, 0, sizeof(*arg)); |
| 1501 | arg->type = PRINT_FLAGS; | 1501 | arg->type = PRINT_FLAGS; |
| 1502 | 1502 | ||
| 1503 | if (read_expected_item(EVENT_DELIM, (char *)"(") < 0) | 1503 | if (read_expected_item(EVENT_DELIM, "(") < 0) |
| 1504 | return EVENT_ERROR; | 1504 | return EVENT_ERROR; |
| 1505 | 1505 | ||
| 1506 | field = malloc_or_die(sizeof(*field)); | 1506 | field = malloc_or_die(sizeof(*field)); |
| 1507 | 1507 | ||
| 1508 | type = process_arg(event, field, &token); | 1508 | type = process_arg(event, field, &token); |
| 1509 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) | 1509 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1510 | goto out_free; | 1510 | goto out_free; |
| 1511 | 1511 | ||
| 1512 | arg->flags.field = field; | 1512 | arg->flags.field = field; |
| @@ -1517,11 +1517,11 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
| 1517 | type = read_token_item(&token); | 1517 | type = read_token_item(&token); |
| 1518 | } | 1518 | } |
| 1519 | 1519 | ||
| 1520 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) | 1520 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1521 | goto out_free; | 1521 | goto out_free; |
| 1522 | 1522 | ||
| 1523 | type = process_fields(event, &arg->flags.flags, &token); | 1523 | type = process_fields(event, &arg->flags.flags, &token); |
| 1524 | if (test_type_token(type, token, EVENT_DELIM, (char *)")")) | 1524 | if (test_type_token(type, token, EVENT_DELIM, ")")) |
| 1525 | goto out_free; | 1525 | goto out_free; |
| 1526 | 1526 | ||
| 1527 | free_token(token); | 1527 | free_token(token); |
| @@ -1543,19 +1543,19 @@ process_symbols(struct event *event, struct print_arg *arg, char **tok) | |||
| 1543 | memset(arg, 0, sizeof(*arg)); | 1543 | memset(arg, 0, sizeof(*arg)); |
| 1544 | arg->type = PRINT_SYMBOL; | 1544 | arg->type = PRINT_SYMBOL; |
| 1545 | 1545 | ||
| 1546 | if (read_expected_item(EVENT_DELIM, (char *)"(") < 0) | 1546 | if (read_expected_item(EVENT_DELIM, "(") < 0) |
| 1547 | return EVENT_ERROR; | 1547 | return EVENT_ERROR; |
| 1548 | 1548 | ||
| 1549 | field = malloc_or_die(sizeof(*field)); | 1549 | field = malloc_or_die(sizeof(*field)); |
| 1550 | 1550 | ||
| 1551 | type = process_arg(event, field, &token); | 1551 | type = process_arg(event, field, &token); |
| 1552 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) | 1552 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1553 | goto out_free; | 1553 | goto out_free; |
| 1554 | 1554 | ||
| 1555 | arg->symbol.field = field; | 1555 | arg->symbol.field = field; |
| 1556 | 1556 | ||
| 1557 | type = process_fields(event, &arg->symbol.symbols, &token); | 1557 | type = process_fields(event, &arg->symbol.symbols, &token); |
| 1558 | if (test_type_token(type, token, EVENT_DELIM, (char *)")")) | 1558 | if (test_type_token(type, token, EVENT_DELIM, ")")) |
| 1559 | goto out_free; | 1559 | goto out_free; |
| 1560 | 1560 | ||
| 1561 | free_token(token); | 1561 | free_token(token); |
| @@ -1585,7 +1585,7 @@ process_paren(struct event *event, struct print_arg *arg, char **tok) | |||
| 1585 | if (type == EVENT_ERROR) | 1585 | if (type == EVENT_ERROR) |
| 1586 | return EVENT_ERROR; | 1586 | return EVENT_ERROR; |
| 1587 | 1587 | ||
| 1588 | if (test_type_token(type, token, EVENT_DELIM, (char *)")")) { | 1588 | if (test_type_token(type, token, EVENT_DELIM, ")")) { |
| 1589 | free_token(token); | 1589 | free_token(token); |
| 1590 | return EVENT_ERROR; | 1590 | return EVENT_ERROR; |
| 1591 | } | 1591 | } |
| @@ -1626,7 +1626,7 @@ process_str(struct event *event __unused, struct print_arg *arg, char **tok) | |||
| 1626 | enum event_type type; | 1626 | enum event_type type; |
| 1627 | char *token; | 1627 | char *token; |
| 1628 | 1628 | ||
| 1629 | if (read_expected(EVENT_DELIM, (char *)"(") < 0) | 1629 | if (read_expected(EVENT_DELIM, "(") < 0) |
| 1630 | return EVENT_ERROR; | 1630 | return EVENT_ERROR; |
| 1631 | 1631 | ||
| 1632 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1632 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| @@ -1636,7 +1636,7 @@ process_str(struct event *event __unused, struct print_arg *arg, char **tok) | |||
| 1636 | arg->string.string = token; | 1636 | arg->string.string = token; |
| 1637 | arg->string.offset = -1; | 1637 | arg->string.offset = -1; |
| 1638 | 1638 | ||
| 1639 | if (read_expected(EVENT_DELIM, (char *)")") < 0) | 1639 | if (read_expected(EVENT_DELIM, ")") < 0) |
| 1640 | return EVENT_ERROR; | 1640 | return EVENT_ERROR; |
| 1641 | 1641 | ||
| 1642 | type = read_token(&token); | 1642 | type = read_token(&token); |
| @@ -1775,13 +1775,13 @@ static int event_read_print(struct event *event) | |||
| 1775 | char *token; | 1775 | char *token; |
| 1776 | int ret; | 1776 | int ret; |
| 1777 | 1777 | ||
| 1778 | if (read_expected_item(EVENT_ITEM, (char *)"print") < 0) | 1778 | if (read_expected_item(EVENT_ITEM, "print") < 0) |
| 1779 | return -1; | 1779 | return -1; |
| 1780 | 1780 | ||
| 1781 | if (read_expected(EVENT_ITEM, (char *)"fmt") < 0) | 1781 | if (read_expected(EVENT_ITEM, "fmt") < 0) |
| 1782 | return -1; | 1782 | return -1; |
| 1783 | 1783 | ||
| 1784 | if (read_expected(EVENT_OP, (char *)":") < 0) | 1784 | if (read_expected(EVENT_OP, ":") < 0) |
| 1785 | return -1; | 1785 | return -1; |
| 1786 | 1786 | ||
| 1787 | if (read_expect_type(EVENT_DQUOTE, &token) < 0) | 1787 | if (read_expect_type(EVENT_DQUOTE, &token) < 0) |
| @@ -1811,8 +1811,8 @@ static int event_read_print(struct event *event) | |||
| 1811 | token = cat; | 1811 | token = cat; |
| 1812 | goto concat; | 1812 | goto concat; |
| 1813 | } | 1813 | } |
| 1814 | 1814 | ||
| 1815 | if (test_type_token(type, token, EVENT_DELIM, (char *)",")) | 1815 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1816 | goto fail; | 1816 | goto fail; |
| 1817 | 1817 | ||
| 1818 | free_token(token); | 1818 | free_token(token); |
| @@ -1931,7 +1931,7 @@ static int get_common_info(const char *type, int *offset, int *size) | |||
| 1931 | } | 1931 | } |
| 1932 | 1932 | ||
| 1933 | static int __parse_common(void *data, int *size, int *offset, | 1933 | static int __parse_common(void *data, int *size, int *offset, |
| 1934 | char *name) | 1934 | const char *name) |
| 1935 | { | 1935 | { |
| 1936 | int ret; | 1936 | int ret; |
| 1937 | 1937 | ||
| @@ -1949,7 +1949,7 @@ int trace_parse_common_type(void *data) | |||
| 1949 | static int type_size; | 1949 | static int type_size; |
| 1950 | 1950 | ||
| 1951 | return __parse_common(data, &type_size, &type_offset, | 1951 | return __parse_common(data, &type_size, &type_offset, |
| 1952 | (char *)"common_type"); | 1952 | "common_type"); |
| 1953 | } | 1953 | } |
| 1954 | 1954 | ||
| 1955 | static int parse_common_pid(void *data) | 1955 | static int parse_common_pid(void *data) |
| @@ -1958,7 +1958,7 @@ static int parse_common_pid(void *data) | |||
| 1958 | static int pid_size; | 1958 | static int pid_size; |
| 1959 | 1959 | ||
| 1960 | return __parse_common(data, &pid_size, &pid_offset, | 1960 | return __parse_common(data, &pid_size, &pid_offset, |
| 1961 | (char *)"common_pid"); | 1961 | "common_pid"); |
| 1962 | } | 1962 | } |
| 1963 | 1963 | ||
| 1964 | static int parse_common_pc(void *data) | 1964 | static int parse_common_pc(void *data) |
| @@ -1967,7 +1967,7 @@ static int parse_common_pc(void *data) | |||
| 1967 | static int pc_size; | 1967 | static int pc_size; |
| 1968 | 1968 | ||
| 1969 | return __parse_common(data, &pc_size, &pc_offset, | 1969 | return __parse_common(data, &pc_size, &pc_offset, |
| 1970 | (char *)"common_preempt_count"); | 1970 | "common_preempt_count"); |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | static int parse_common_flags(void *data) | 1973 | static int parse_common_flags(void *data) |
| @@ -1976,7 +1976,7 @@ static int parse_common_flags(void *data) | |||
| 1976 | static int flags_size; | 1976 | static int flags_size; |
| 1977 | 1977 | ||
| 1978 | return __parse_common(data, &flags_size, &flags_offset, | 1978 | return __parse_common(data, &flags_size, &flags_offset, |
| 1979 | (char *)"common_flags"); | 1979 | "common_flags"); |
| 1980 | } | 1980 | } |
| 1981 | 1981 | ||
| 1982 | static int parse_common_lock_depth(void *data) | 1982 | static int parse_common_lock_depth(void *data) |
| @@ -1986,7 +1986,7 @@ static int parse_common_lock_depth(void *data) | |||
| 1986 | int ret; | 1986 | int ret; |
| 1987 | 1987 | ||
| 1988 | ret = __parse_common(data, &ld_size, &ld_offset, | 1988 | ret = __parse_common(data, &ld_size, &ld_offset, |
| 1989 | (char *)"common_lock_depth"); | 1989 | "common_lock_depth"); |
| 1990 | if (ret < 0) | 1990 | if (ret < 0) |
| 1991 | return -1; | 1991 | return -1; |
| 1992 | 1992 | ||
| @@ -3049,15 +3049,15 @@ static void print_args(struct print_arg *args) | |||
| 3049 | } | 3049 | } |
| 3050 | } | 3050 | } |
| 3051 | 3051 | ||
| 3052 | static void parse_header_field(char *field, | 3052 | static void parse_header_field(const char *field, |
| 3053 | int *offset, int *size) | 3053 | int *offset, int *size) |
| 3054 | { | 3054 | { |
| 3055 | char *token; | 3055 | char *token; |
| 3056 | int type; | 3056 | int type; |
| 3057 | 3057 | ||
| 3058 | if (read_expected(EVENT_ITEM, (char *)"field") < 0) | 3058 | if (read_expected(EVENT_ITEM, "field") < 0) |
| 3059 | return; | 3059 | return; |
| 3060 | if (read_expected(EVENT_OP, (char *)":") < 0) | 3060 | if (read_expected(EVENT_OP, ":") < 0) |
| 3061 | return; | 3061 | return; |
| 3062 | 3062 | ||
| 3063 | /* type */ | 3063 | /* type */ |
| @@ -3067,27 +3067,27 @@ static void parse_header_field(char *field, | |||
| 3067 | 3067 | ||
| 3068 | if (read_expected(EVENT_ITEM, field) < 0) | 3068 | if (read_expected(EVENT_ITEM, field) < 0) |
| 3069 | return; | 3069 | return; |
| 3070 | if (read_expected(EVENT_OP, (char *)";") < 0) | 3070 | if (read_expected(EVENT_OP, ";") < 0) |
| 3071 | return; | 3071 | return; |
| 3072 | if (read_expected(EVENT_ITEM, (char *)"offset") < 0) | 3072 | if (read_expected(EVENT_ITEM, "offset") < 0) |
| 3073 | return; | 3073 | return; |
| 3074 | if (read_expected(EVENT_OP, (char *)":") < 0) | 3074 | if (read_expected(EVENT_OP, ":") < 0) |
| 3075 | return; | 3075 | return; |
| 3076 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 3076 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| 3077 | goto fail; | 3077 | goto fail; |
| 3078 | *offset = atoi(token); | 3078 | *offset = atoi(token); |
| 3079 | free_token(token); | 3079 | free_token(token); |
| 3080 | if (read_expected(EVENT_OP, (char *)";") < 0) | 3080 | if (read_expected(EVENT_OP, ";") < 0) |
| 3081 | return; | 3081 | return; |
| 3082 | if (read_expected(EVENT_ITEM, (char *)"size") < 0) | 3082 | if (read_expected(EVENT_ITEM, "size") < 0) |
| 3083 | return; | 3083 | return; |
| 3084 | if (read_expected(EVENT_OP, (char *)":") < 0) | 3084 | if (read_expected(EVENT_OP, ":") < 0) |
| 3085 | return; | 3085 | return; |
| 3086 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 3086 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
| 3087 | goto fail; | 3087 | goto fail; |
| 3088 | *size = atoi(token); | 3088 | *size = atoi(token); |
| 3089 | free_token(token); | 3089 | free_token(token); |
| 3090 | if (read_expected(EVENT_OP, (char *)";") < 0) | 3090 | if (read_expected(EVENT_OP, ";") < 0) |
| 3091 | return; | 3091 | return; |
| 3092 | type = read_token(&token); | 3092 | type = read_token(&token); |
| 3093 | if (type != EVENT_NEWLINE) { | 3093 | if (type != EVENT_NEWLINE) { |
| @@ -3095,19 +3095,19 @@ static void parse_header_field(char *field, | |||
| 3095 | if (type != EVENT_ITEM) | 3095 | if (type != EVENT_ITEM) |
| 3096 | goto fail; | 3096 | goto fail; |
| 3097 | 3097 | ||
| 3098 | if (strcmp(token, (char *)"signed") != 0) | 3098 | if (strcmp(token, "signed") != 0) |
| 3099 | goto fail; | 3099 | goto fail; |
| 3100 | 3100 | ||
| 3101 | free_token(token); | 3101 | free_token(token); |
| 3102 | 3102 | ||
| 3103 | if (read_expected(EVENT_OP, (char *)":") < 0) | 3103 | if (read_expected(EVENT_OP, ":") < 0) |
| 3104 | return; | 3104 | return; |
| 3105 | 3105 | ||
| 3106 | if (read_expect_type(EVENT_ITEM, &token)) | 3106 | if (read_expect_type(EVENT_ITEM, &token)) |
| 3107 | goto fail; | 3107 | goto fail; |
| 3108 | 3108 | ||
| 3109 | free_token(token); | 3109 | free_token(token); |
| 3110 | if (read_expected(EVENT_OP, (char *)";") < 0) | 3110 | if (read_expected(EVENT_OP, ";") < 0) |
| 3111 | return; | 3111 | return; |
| 3112 | 3112 | ||
| 3113 | if (read_expect_type(EVENT_NEWLINE, &token)) | 3113 | if (read_expect_type(EVENT_NEWLINE, &token)) |
| @@ -3121,11 +3121,11 @@ int parse_header_page(char *buf, unsigned long size) | |||
| 3121 | { | 3121 | { |
| 3122 | init_input_buf(buf, size); | 3122 | init_input_buf(buf, size); |
| 3123 | 3123 | ||
| 3124 | parse_header_field((char *)"timestamp", &header_page_ts_offset, | 3124 | parse_header_field("timestamp", &header_page_ts_offset, |
| 3125 | &header_page_ts_size); | 3125 | &header_page_ts_size); |
| 3126 | parse_header_field((char *)"commit", &header_page_size_offset, | 3126 | parse_header_field("commit", &header_page_size_offset, |
| 3127 | &header_page_size_size); | 3127 | &header_page_size_size); |
| 3128 | parse_header_field((char *)"data", &header_page_data_offset, | 3128 | parse_header_field("data", &header_page_data_offset, |
| 3129 | &header_page_data_size); | 3129 | &header_page_data_size); |
| 3130 | 3130 | ||
| 3131 | return 0; | 3131 | return 0; |
