diff options
author | Karel Klic <kklic@redhat.com> | 2010-10-14 18:23:59 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2010-10-14 18:23:59 +0200 |
commit | ab45fe20636f305fa8b033d2af8946d75eff7f8a (patch) | |
tree | c7000d999e0c72f8e2b1d7b512ba94709a6121a3 | |
parent | 04fd9f5fcd10dc9bd22818490b5c91388728519c (diff) | |
download | abrt-ab45fe20636f305fa8b033d2af8946d75eff7f8a.tar.gz abrt-ab45fe20636f305fa8b033d2af8946d75eff7f8a.tar.xz abrt-ab45fe20636f305fa8b033d2af8946d75eff7f8a.zip |
btparser integration: use ABRT's strbuf instead of internal one
-rw-r--r-- | src/btparser/Makefile.am | 4 | ||||
-rw-r--r-- | src/btparser/backtrace.c | 8 | ||||
-rw-r--r-- | src/btparser/frame.c | 102 | ||||
-rw-r--r-- | src/btparser/frame.h | 6 | ||||
-rw-r--r-- | src/btparser/strbuf.c | 151 | ||||
-rw-r--r-- | src/btparser/strbuf.h | 124 | ||||
-rw-r--r-- | src/btparser/thread.c | 6 | ||||
-rw-r--r-- | src/btparser/thread.h | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/btparser/Makefile.am | 1 | ||||
-rw-r--r-- | tests/btparser/frame.at | 6 | ||||
-rw-r--r-- | tests/strbuf.at (renamed from tests/btparser/strbuf.at) | 24 | ||||
-rw-r--r-- | tests/testsuite.at | 2 |
14 files changed, 84 insertions, 359 deletions
diff --git a/src/btparser/Makefile.am b/src/btparser/Makefile.am index ceb03f3d..b610f30c 100644 --- a/src/btparser/Makefile.am +++ b/src/btparser/Makefile.am @@ -11,11 +11,11 @@ libbtparser_la_SOURCES = \ normalize_libstdcpp.c \ normalize_linux.c \ normalize_xorg.c \ - strbuf.h strbuf.c \ thread.h thread.c \ utils.h utils.c -libbtparser_la_CFLAGS = -Wall -Werror -D_GNU_SOURCE +libbtparser_la_CFLAGS = -Wall -Werror -D_GNU_SOURCE -I../../lib/utils libbtparser_la_LDFLAGS = -version-info 1:1:0 +libbtparser_la_LIBADD = ../../lib/utils/libABRTUtils.la # From http://www.seul.org/docs/autotut/ # Version consists 3 numbers: CURRENT, REVISION, AGE. diff --git a/src/btparser/backtrace.c b/src/btparser/backtrace.c index 576c1776..139b315d 100644 --- a/src/btparser/backtrace.c +++ b/src/btparser/backtrace.c @@ -267,16 +267,16 @@ btp_backtrace_quality_complex(struct btp_backtrace *backtrace) char * btp_backtrace_to_text(struct btp_backtrace *backtrace, bool verbose) { - struct btp_strbuf *str = btp_strbuf_new(); + struct strbuf *str = strbuf_new(); if (verbose) { - btp_strbuf_append_strf(str, "Thread count: %d\n", + strbuf_append_strf(str, "Thread count: %d\n", btp_backtrace_get_thread_count(backtrace)); } if (backtrace->crash && verbose) { - btp_strbuf_append_str(str, "Crash frame: "); + strbuf_append_str(str, "Crash frame: "); btp_frame_append_to_str(backtrace->crash, str, verbose); } @@ -287,7 +287,7 @@ btp_backtrace_to_text(struct btp_backtrace *backtrace, bool verbose) thread = thread->next; } - return btp_strbuf_free_nobuf(str); + return strbuf_free_nobuf(str); } struct btp_frame * diff --git a/src/btparser/frame.c b/src/btparser/frame.c index 83680910..2bfae070 100644 --- a/src/btparser/frame.c +++ b/src/btparser/frame.c @@ -209,29 +209,29 @@ btp_frame_add_sibling(struct btp_frame *a, struct btp_frame *b) void btp_frame_append_to_str(struct btp_frame *frame, - struct btp_strbuf *str, + struct strbuf *str, bool verbose) { if (verbose) - btp_strbuf_append_strf(str, " #%d", frame->number); + strbuf_append_strf(str, " #%d", frame->number); else - btp_strbuf_append_str(str, " "); + strbuf_append_str(str, " "); if (frame->function_type) - btp_strbuf_append_strf(str, " %s", frame->function_type); + strbuf_append_strf(str, " %s", frame->function_type); if (frame->function_name) - btp_strbuf_append_strf(str, " %s", frame->function_name); + strbuf_append_strf(str, " %s", frame->function_name); if (verbose && frame->source_file) { if (frame->function_name) - btp_strbuf_append_str(str, " at"); - btp_strbuf_append_strf(str, " %s", frame->source_file); + strbuf_append_str(str, " at"); + strbuf_append_strf(str, " %s", frame->source_file); } if (frame->signal_handler_called) - btp_strbuf_append_str(str, " <signal handler called>"); + strbuf_append_str(str, " <signal handler called>"); - btp_strbuf_append_str(str, "\n"); + strbuf_append_str(str, "\n"); } /** @@ -308,7 +308,7 @@ btp_frame_parse_frame_start(char **input, unsigned *number) } int -btp_frame_parseadd_operator(char **input, struct btp_strbuf *target) +btp_frame_parseadd_operator(char **input, struct strbuf *target) { char *local_input = *input; if (0 == btp_skip_string(&local_input, "operator")) @@ -317,8 +317,8 @@ btp_frame_parseadd_operator(char **input, struct btp_strbuf *target) #define OP(x) \ if (0 < btp_skip_string(&local_input, x)) \ { \ - btp_strbuf_append_str(target, "operator"); \ - btp_strbuf_append_str(target, x); \ + strbuf_append_str(target, "operator"); \ + strbuf_append_str(target, x); \ int length = local_input - *input; \ *input = local_input; \ return length; \ @@ -357,7 +357,7 @@ btp_frame_parse_function_name_chunk(char **input, char **target) { char *local_input = *input; - struct btp_strbuf *buf = btp_strbuf_new(); + struct strbuf *buf = strbuf_new(); while (*local_input) { if (0 < btp_frame_parseadd_operator(&local_input, buf)) @@ -373,7 +373,7 @@ btp_frame_parse_function_name_chunk(char **input, local_input -= 2; } else - btp_strbuf_append_char(buf, ' '); + strbuf_append_char(buf, ' '); } } @@ -383,17 +383,17 @@ btp_frame_parse_function_name_chunk(char **input, break; } - btp_strbuf_append_char(buf, *local_input); + strbuf_append_char(buf, *local_input); ++local_input; } if (buf->len == 0) { - btp_strbuf_free(buf); + strbuf_free(buf); return 0; } - *target = btp_strbuf_free_nobuf(buf); + *target = strbuf_free_nobuf(buf); int total_char_count = local_input - *input; *input = local_input; return total_char_count; @@ -406,8 +406,8 @@ btp_frame_parse_function_name_braces(char **input, char **target) if (!btp_skip_char(&local_input, '(')) return 0; - struct btp_strbuf *buf = btp_strbuf_new(); - btp_strbuf_append_char(buf, '('); + struct strbuf *buf = strbuf_new(); + strbuf_append_char(buf, '('); while (true) { char *namechunk = NULL; @@ -415,7 +415,7 @@ btp_frame_parse_function_name_braces(char **input, char **target) 0 < btp_frame_parse_function_name_braces(&local_input, &namechunk) || 0 < btp_frame_parse_function_name_template(&local_input, &namechunk)) { - btp_strbuf_append_str(buf, namechunk); + strbuf_append_str(buf, namechunk); free(namechunk); } else @@ -424,12 +424,12 @@ btp_frame_parse_function_name_braces(char **input, char **target) if (!btp_skip_char(&local_input, ')')) { - btp_strbuf_free(buf); + strbuf_free(buf); return 0; } - btp_strbuf_append_char(buf, ')'); - *target = btp_strbuf_free_nobuf(buf); + strbuf_append_char(buf, ')'); + *target = strbuf_free_nobuf(buf); int total_char_count = local_input - *input; *input = local_input; return total_char_count; @@ -442,8 +442,8 @@ btp_frame_parse_function_name_template(char **input, char **target) if (!btp_skip_char(&local_input, '<')) return 0; - struct btp_strbuf *buf = btp_strbuf_new(); - btp_strbuf_append_char(buf, '<'); + struct strbuf *buf = strbuf_new(); + strbuf_append_char(buf, '<'); while (true) { char *namechunk = NULL; @@ -451,7 +451,7 @@ btp_frame_parse_function_name_template(char **input, char **target) 0 < btp_frame_parse_function_name_braces(&local_input, &namechunk) || 0 < btp_frame_parse_function_name_template(&local_input, &namechunk)) { - btp_strbuf_append_str(buf, namechunk); + strbuf_append_str(buf, namechunk); free(namechunk); } else @@ -460,12 +460,12 @@ btp_frame_parse_function_name_template(char **input, char **target) if (!btp_skip_char(&local_input, '>')) { - btp_strbuf_free(buf); + strbuf_free(buf); return 0; } - btp_strbuf_append_char(buf, '>'); - *target = btp_strbuf_free_nobuf(buf); + strbuf_append_char(buf, '>'); + *target = strbuf_free_nobuf(buf); int total_char_count = local_input - *input; *input = local_input; return total_char_count; @@ -488,7 +488,7 @@ btp_frame_parse_function_name(char **input, char *local_input = *input; /* Up to three parts of function name. */ - struct btp_strbuf *buf0 = btp_strbuf_new(), *buf1 = NULL; + struct strbuf *buf0 = strbuf_new(), *buf1 = NULL; /* First character: '~' for destructor @@ -505,7 +505,7 @@ btp_frame_parse_function_name(char **input, --local_input; else { - btp_strbuf_append_char(buf0, first); + strbuf_append_char(buf0, first); ++location->column; } } @@ -515,14 +515,14 @@ btp_frame_parse_function_name(char **input, &namechunk); if (0 < chars) { - btp_strbuf_append_str(buf0, namechunk); + strbuf_append_str(buf0, namechunk); free(namechunk); location->column += chars; } else { location->message = "Expected function name."; - btp_strbuf_free(buf0); + strbuf_free(buf0); return false; } } @@ -550,7 +550,7 @@ btp_frame_parse_function_name(char **input, if (0 == chars) break; - btp_strbuf_append_str(buf0, namechunk); + strbuf_append_str(buf0, namechunk); free(namechunk); location->column += chars; } @@ -559,7 +559,7 @@ btp_frame_parse_function_name(char **input, char space; if (!btp_parse_char_limited(&local_input, BTP_space, &space)) { - btp_strbuf_free(buf0); + strbuf_free(buf0); location->message = "Space or newline expected after function name."; return false; } @@ -569,16 +569,16 @@ btp_frame_parse_function_name(char **input, int chars = btp_skip_string(&local_input, "const"); if (0 < chars) { - btp_strbuf_append_char(buf0, space); + strbuf_append_char(buf0, space); btp_location_eat_char(location, space); - btp_strbuf_append_str(buf0, "const"); + strbuf_append_str(buf0, "const"); location->column += chars; /* Check the empty space after function name again.*/ if (!btp_parse_char_limited(&local_input, BTP_space, &space)) { /* Function name MUST be ended by empty space. */ - btp_strbuf_free(buf0); + strbuf_free(buf0); location->message = "Space or newline expected after function name."; return false; } @@ -595,8 +595,8 @@ btp_frame_parse_function_name(char **input, /* Eat the space separator first. */ btp_location_eat_char(location, space); - buf1 = btp_strbuf_new(); - btp_strbuf_append_str(buf1, namechunk); + buf1 = strbuf_new(); + strbuf_append_str(buf1, namechunk); free(namechunk); location->column += chars; @@ -620,7 +620,7 @@ btp_frame_parse_function_name(char **input, if (0 == chars) break; - btp_strbuf_append_str(buf1, namechunk); + strbuf_append_str(buf1, namechunk); free(namechunk); location->column += chars; } @@ -628,8 +628,8 @@ btp_frame_parse_function_name(char **input, /* Function name MUST be ended by empty space. */ if (!btp_parse_char_limited(&local_input, BTP_space, &space)) { - btp_strbuf_free(buf0); - btp_strbuf_free(buf1); + strbuf_free(buf0); + strbuf_free(buf1); location->message = "Space or newline expected after function name."; return false; } @@ -639,18 +639,18 @@ btp_frame_parse_function_name(char **input, chars = btp_skip_string(&local_input, "const"); if (0 < chars) { - struct btp_strbuf *buf = buf1 ? buf1 : buf0; - btp_strbuf_append_char(buf, space); + struct strbuf *buf = buf1 ? buf1 : buf0; + strbuf_append_char(buf, space); btp_location_eat_char(location, space); - btp_strbuf_append_str(buf, "const"); + strbuf_append_str(buf, "const"); location->column += chars; /* Check the empty space after function name again.*/ if (!btp_skip_char_limited(&local_input, BTP_space)) { /* Function name MUST be ended by empty space. */ - btp_strbuf_free(buf0); - btp_strbuf_free(buf1); + strbuf_free(buf0); + strbuf_free(buf1); location->message = "Space or newline expected after function name."; return false; } @@ -661,12 +661,12 @@ btp_frame_parse_function_name(char **input, if (buf1) { - *function_name = btp_strbuf_free_nobuf(buf1); - *function_type = btp_strbuf_free_nobuf(buf0); + *function_name = strbuf_free_nobuf(buf1); + *function_type = strbuf_free_nobuf(buf0); } else { - *function_name = btp_strbuf_free_nobuf(buf0); + *function_name = strbuf_free_nobuf(buf0); *function_type = NULL; } diff --git a/src/btparser/frame.h b/src/btparser/frame.h index 3cc19c3c..966dd5d2 100644 --- a/src/btparser/frame.h +++ b/src/btparser/frame.h @@ -27,7 +27,7 @@ extern "C" { #endif -struct btp_strbuf; +struct strbuf; struct btp_location; /** @@ -234,7 +234,7 @@ btp_frame_add_sibling(struct btp_frame *a, */ void btp_frame_append_to_str(struct btp_frame *frame, - struct btp_strbuf *str, + struct strbuf *str, bool verbose); /** @@ -285,7 +285,7 @@ btp_frame_parse_frame_start(char **input, unsigned *number); */ int btp_frame_parseadd_operator(char **input, - struct btp_strbuf *target); + struct strbuf *target); /** * Parses a part of function name from the input. diff --git a/src/btparser/strbuf.c b/src/btparser/strbuf.c deleted file mode 100644 index 43d834fd..00000000 --- a/src/btparser/strbuf.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - strbuf.c - string buffer - - Copyright (C) 2010 Red Hat, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "strbuf.h" -#include "utils.h" -#include <stdlib.h> -#include <stdio.h> -#include <assert.h> -#include <string.h> -#include <stdarg.h> - -struct btp_strbuf * -btp_strbuf_new() -{ - struct btp_strbuf *buf = btp_malloc(sizeof(struct btp_strbuf)); - buf->alloc = 8; - buf->len = 0; - buf->buf = btp_malloc(buf->alloc); - buf->buf[buf->len] = '\0'; - return buf; -} - -void -btp_strbuf_free(struct btp_strbuf *strbuf) -{ - if (!strbuf) - return; - - free(strbuf->buf); - free(strbuf); -} - -char * -btp_strbuf_free_nobuf(struct btp_strbuf *strbuf) -{ - char *buf = strbuf->buf; - free(strbuf); - return buf; -} - - -void -btp_strbuf_clear(struct btp_strbuf *strbuf) -{ - assert(strbuf->alloc > 0); - strbuf->len = 0; - strbuf->buf[0] = '\0'; -} - -/* Ensures that the buffer can be extended by num characters - * without touching malloc/realloc. - */ -void -btp_strbuf_grow(struct btp_strbuf *strbuf, int num) -{ - if (strbuf->len + num + 1 > strbuf->alloc) - { - while (strbuf->len + num + 1 > strbuf->alloc) - strbuf->alloc *= 2; /* huge grow = infinite loop */ - - strbuf->buf = realloc(strbuf->buf, strbuf->alloc); - if (!strbuf->buf) - { - puts("Error while allocating memory for string buffer."); - exit(5); - } - } -} - -struct btp_strbuf * -btp_strbuf_append_char(struct btp_strbuf *strbuf, - char c) -{ - btp_strbuf_grow(strbuf, 1); - strbuf->buf[strbuf->len++] = c; - strbuf->buf[strbuf->len] = '\0'; - return strbuf; -} - -struct btp_strbuf * -btp_strbuf_append_str(struct btp_strbuf *strbuf, - const char *str) -{ - int len = strlen(str); - btp_strbuf_grow(strbuf, len); - assert(strbuf->len + len < strbuf->alloc); - strcpy(strbuf->buf + strbuf->len, str); - strbuf->len += len; - return strbuf; -} - -struct btp_strbuf * -btp_strbuf_prepend_str(struct btp_strbuf *strbuf, - const char *str) -{ - int len = strlen(str); - btp_strbuf_grow(strbuf, len); - assert(strbuf->len + len < strbuf->alloc); - memmove(strbuf->buf + len, strbuf->buf, strbuf->len + 1); - memcpy(strbuf->buf, str, len); - strbuf->len += len; - return strbuf; -} - -struct btp_strbuf * -btp_strbuf_append_strf(struct btp_strbuf *strbuf, - const char *format, ...) -{ - va_list p; - char *string_ptr; - - va_start(p, format); - string_ptr = btp_vasprintf(format, p); - va_end(p); - - btp_strbuf_append_str(strbuf, string_ptr); - free(string_ptr); - return strbuf; -} - -struct btp_strbuf * -btp_strbuf_prepend_strf(struct btp_strbuf *strbuf, - const char *format, ...) -{ - va_list p; - char *string_ptr; - - va_start(p, format); - string_ptr = btp_vasprintf(format, p); - va_end(p); - - btp_strbuf_prepend_str(strbuf, string_ptr); - free(string_ptr); - return strbuf; -} diff --git a/src/btparser/strbuf.h b/src/btparser/strbuf.h deleted file mode 100644 index d8503e02..00000000 --- a/src/btparser/strbuf.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - strbuf.h - a string buffer - - Copyright (C) 2010 Red Hat, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef BTPARSER_STRBUF_H -#define BTPARSER_STRBUF_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct btp_strbuf -{ - /** - * Size of the allocated buffer. Always > 0. - */ - int alloc; - /** - * Length of the string, without the ending \0. - */ - int len; - char *buf; -}; - -/** - * Creates and initializes a new string buffer. - * @returns - * It never returns NULL. The returned pointer must be released by - * calling the function btp_strbuf_free(). - */ -struct btp_strbuf * -btp_strbuf_new(); - -/** - * Releases the memory held by the string buffer. - * @param strbuf - * If the strbuf is NULL, no operation is performed. - */ -void -btp_strbuf_free(struct btp_strbuf *strbuf); - -/** - * Releases the strbuf, but not the internal buffer. The internal - * string buffer is returned. Caller is responsible to release the - * returned memory using free(). - */ -char * -btp_strbuf_free_nobuf(struct btp_strbuf *strbuf); - -/** - * The string content is set to an empty string, erasing any previous - * content and leaving its length at 0 characters. - */ -void -btp_strbuf_clear(struct btp_strbuf *strbuf); - -/** - * Ensures that the buffer can be extended by num characters - * without dealing with malloc/realloc. - */ -void -btp_strbuf_grow(struct btp_strbuf *strbuf, int num); - -/** - * The current content of the string buffer is extended by adding a - * character c at its end. - */ -struct btp_strbuf * -btp_strbuf_append_char(struct btp_strbuf *strbuf, - char c); - -/** - * The current content of the string buffer is extended by adding a - * string str at its end. - */ -struct btp_strbuf * -btp_strbuf_append_str(struct btp_strbuf *strbuf, - const char *str); - -/** - * The current content of the string buffer is extended by inserting a - * string str at its beginning. - */ -struct btp_strbuf * -btp_strbuf_prepend_str(struct btp_strbuf *strbuf, - const char *str); - -/** - * The current content of the string buffer is extended by adding a - * sequence of data formatted as the format argument specifies. - */ -struct btp_strbuf * -btp_strbuf_append_strf(struct btp_strbuf *strbuf, - const char *format, ...); - -/** - * The current content of the string buffer is extended by inserting a - * sequence of data formatted as the format argument specifies at the - * buffer beginning. - */ -struct btp_strbuf * -btp_strbuf_prepend_strf(struct btp_strbuf *strbuf, - const char *format, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/btparser/thread.c b/src/btparser/thread.c index 1a7f715e..af480eb3 100644 --- a/src/btparser/thread.c +++ b/src/btparser/thread.c @@ -238,17 +238,17 @@ btp_thread_remove_frames_below_n(struct btp_thread *thread, void btp_thread_append_to_str(struct btp_thread *thread, - struct btp_strbuf *str, + struct strbuf *str, bool verbose) { int framecount = btp_thread_get_frame_count(thread); if (verbose) { - btp_strbuf_append_strf(str, "Thread no. %d (%d frames)\n", + strbuf_append_strf(str, "Thread no. %d (%d frames)\n", thread->number, framecount); } else - btp_strbuf_append_str(str, "Thread\n"); + strbuf_append_str(str, "Thread\n"); struct btp_frame *frame = thread->frames; while (frame) diff --git a/src/btparser/thread.h b/src/btparser/thread.h index b9f0973d..f7287385 100644 --- a/src/btparser/thread.h +++ b/src/btparser/thread.h @@ -27,7 +27,7 @@ extern "C" { #endif struct btp_frame; -struct btp_strbuf; +struct strbuf; struct btp_location; /** @@ -175,7 +175,7 @@ btp_thread_remove_frames_below_n(struct btp_thread *thread, */ void btp_thread_append_to_str(struct btp_thread *thread, - struct btp_strbuf *str, + struct strbuf *str, bool verbose); /** diff --git a/tests/Makefile.am b/tests/Makefile.am index 58cd2b3e..7903a30b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -28,7 +28,8 @@ EXTRA_DIST = package.m4 TESTSUITE_AT = \ local.at \ - testsuite.at + testsuite.at \ + strbuf.at EXTRA_DIST += $(TESTSUITE_AT) TESTSUITE = $(srcdir)/testsuite diff --git a/tests/atlocal.in b/tests/atlocal.in index 2d148968..62cba99d 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -6,7 +6,7 @@ CC='@CC@' LIBTOOL="$abs_top_builddir/libtool" # We want no optimization. -CFLAGS="@O0CFLAGS@ -I$abs_top_builddir/src/btparser -D_GNU_SOURCE" +CFLAGS="@O0CFLAGS@ -I$abs_top_builddir/src/btparser -I$abs_top_builddir/lib/utils -D_GNU_SOURCE" # Are special link options needed? LDFLAGS="@LDFLAGS@ $abs_top_builddir/src/btparser/libbtparser.la" diff --git a/tests/btparser/Makefile.am b/tests/btparser/Makefile.am index 57805452..5dd52e2a 100644 --- a/tests/btparser/Makefile.am +++ b/tests/btparser/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = backtraces TESTSUITE_AT = \ utils.at \ - strbuf.at \ frame.at \ thread.at \ backtrace.at diff --git a/tests/btparser/frame.at b/tests/btparser/frame.at index b9b0e3b4..92bcc652 100644 --- a/tests/btparser/frame.at +++ b/tests/btparser/frame.at @@ -112,7 +112,7 @@ int main(void) AT_TESTFUN([btp_frame_parseadd_operator], [[ #include <frame.h> -#include <strbuf.h> +#include "strbuf.h" #include <assert.h> #include <string.h> @@ -120,7 +120,7 @@ void check(char *input, int parsed_length) { printf("Testing '%s' -> %d\n", input, parsed_length); char *old_input = input; - struct btp_strbuf *strbuf = btp_strbuf_new(); + struct strbuf *strbuf = strbuf_new(); assert(parsed_length == btp_frame_parseadd_operator(&input, strbuf)); printf(" input = '%s', old_input = '%s'\n", input, old_input); @@ -131,7 +131,7 @@ void check(char *input, int parsed_length) assert(0 == strncmp(strbuf->buf, old_input, parsed_length)); assert(strbuf->len == parsed_length); - btp_strbuf_free(strbuf); + strbuf_free(strbuf); } int main(void) diff --git a/tests/btparser/strbuf.at b/tests/strbuf.at index 5c0a957a..d2db8b9c 100644 --- a/tests/btparser/strbuf.at +++ b/tests/strbuf.at @@ -3,40 +3,40 @@ AT_BANNER([strbuf]) ## ---------------------- ## -## btp_strbuf_append_char ## +## strbuf_append_char ## ## ---------------------- ## -AT_TESTFUN([btp_strbuf_append_char], +AT_TESTFUN([strbuf_append_char], [[ -#include <strbuf.h> +#include "strbuf.h" #include <assert.h> int main(void) { int i; - struct btp_strbuf *strbuf = btp_strbuf_new(); + struct strbuf *strbuf = strbuf_new(); for (i = 0; i < 100; ++i) { assert(strbuf->len == i); assert(strbuf->alloc > strbuf->len); assert(strbuf->buf[i] == '\0'); - btp_strbuf_append_char(strbuf, 'a'); + strbuf_append_char(strbuf, 'a'); assert(strbuf->buf[i] == 'a'); assert(strbuf->buf[i+1] == '\0'); assert(strbuf->len == i + 1); assert(strbuf->alloc > strbuf->len); } - btp_strbuf_free(strbuf); + strbuf_free(strbuf); return 0; } ]]) ## --------------------- ## -## btp_strbuf_append_str ## +## strbuf_append_str ## ## --------------------- ## -AT_TESTFUN([btp_strbuf_append_str], +AT_TESTFUN([strbuf_append_str], [[ -#include <strbuf.h> +#include "strbuf.h" #include <assert.h> /* Test appending strings of certain length. 'len' must be < 50. */ @@ -48,19 +48,19 @@ void test(int len) str[i] = 'a'; str[i] = '\0'; - struct btp_strbuf *strbuf = btp_strbuf_new(); + struct strbuf *strbuf = strbuf_new(); for (i = 0; i < 100; ++i) { assert(strbuf->len == i*len); assert(strbuf->alloc > strbuf->len); assert(strbuf->buf[i*len] == '\0'); - btp_strbuf_append_str(strbuf, str); + strbuf_append_str(strbuf, str); assert(strbuf->buf[i*len] == str[0]); assert(strbuf->buf[i*len+len] == '\0'); assert(strbuf->len == i*len + len); assert(strbuf->alloc > strbuf->len); } - btp_strbuf_free(strbuf); + strbuf_free(strbuf); } int main(void) diff --git a/tests/testsuite.at b/tests/testsuite.at index 24c2a2b6..0ddf595d 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,8 +1,8 @@ # Test suite for abrt. # See http://www.gnu.org/software/hello/manual/autoconf/Writing-Testsuites.html +m4_include([strbuf.at]) m4_include([btparser/utils.at]) -m4_include([btparser/strbuf.at]) m4_include([btparser/frame.at]) m4_include([btparser/thread.at]) m4_include([btparser/backtrace.at]) |