1
This commit is contained in:
Alex Yatskov 2021-01-09 15:22:43 -08:00
parent f70b0cc19f
commit 13de8b5081
48 changed files with 7593 additions and 8141 deletions

4
all.c
View File

@ -36,7 +36,6 @@ static EB_Error_Code eb_search_all(EB_Book* book, EB_Word_Code word_code) {
EB_Error_Code error_code = EB_SUCCESS;
do {
eb_lock(&book->lock);
LOG(("in: eb_search_all(book=%d)", book->code));
/* Current subbook must have been set. */
@ -101,13 +100,11 @@ static EB_Error_Code eb_search_all(EB_Book* book, EB_Word_Code word_code) {
}
LOG(("out: eb_search_all() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
int eb_have_all_search(EB_Book* book) {
eb_lock(&book->lock);
LOG(("in: eb_have_all_search(book=%d)", book->code));
int result = 0;
@ -126,7 +123,6 @@ int eb_have_all_search(EB_Book* book) {
}
LOG(("out: eb_have_all_search() = %d", result));
eb_unlock(&book->lock);
return result;
}

View File

@ -93,7 +93,6 @@ eb_initialize_appendix(EB_Appendix *appendix)
appendix->subbook_count = 0;
appendix->subbooks = NULL;
appendix->subbook_current = NULL;
eb_initialize_lock(&appendix->lock);
eb_initialize_alt_caches(appendix);
LOG(("out: eb_initialize_appendix()"));
@ -125,7 +124,6 @@ eb_finalize_appendix(EB_Appendix *appendix)
appendix->subbook_count = 0;
}
appendix->subbook_current = NULL;
eb_finalize_lock(&appendix->lock);
eb_finalize_alt_caches(appendix);
LOG(("out: eb_finalize_appendix()"));
@ -141,7 +139,6 @@ eb_bind_appendix(EB_Appendix *appendix, const char *path)
EB_Error_Code error_code;
char temporary_path[EB_MAX_PATH_LENGTH + 1];
eb_lock(&appendix->lock);
LOG(("in: eb_bind_appendix(path=%s)", path));
/*
@ -155,9 +152,7 @@ eb_bind_appendix(EB_Appendix *appendix, const char *path)
/*
* Assign a book code.
*/
pthread_mutex_lock(&appendix_counter_mutex);
appendix->code = appendix_counter++;
pthread_mutex_unlock(&appendix_counter_mutex);
/*
* Set path of the appendix.
@ -196,7 +191,6 @@ eb_bind_appendix(EB_Appendix *appendix, const char *path)
LOG(("out: eb_bind_appendix(appendix=%d) = %s", (int)appendix->code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -206,7 +200,6 @@ eb_bind_appendix(EB_Appendix *appendix, const char *path)
failed:
eb_finalize_appendix(appendix);
LOG(("out: eb_bind_appendix() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -346,13 +339,11 @@ eb_is_appendix_bound(EB_Appendix *appendix)
{
int is_bound;
eb_lock(&appendix->lock);
LOG(("in: eb_is_appendix_bound(appendix=%d)", (int)appendix->code));
is_bound = (appendix->path != NULL);
LOG(("out: eb_is_appendix_bound() = %d", is_bound));
eb_unlock(&appendix->lock);
return is_bound;
}
@ -366,7 +357,6 @@ eb_appendix_path(EB_Appendix *appendix, char *path)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_appendix_path(appendix=%d)", (int)appendix->code));
/*
@ -384,7 +374,6 @@ eb_appendix_path(EB_Appendix *appendix, char *path)
LOG(("out: eb_appendix_path(path=%s) = %s",
path, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -394,6 +383,5 @@ eb_appendix_path(EB_Appendix *appendix, char *path)
failed:
*path = '\0';
LOG(("out: eb_appendix_path() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}

View File

@ -29,10 +29,6 @@
#ifndef EB_APPENDIX_H
#define EB_APPENDIX_H
#ifdef __cplusplus
extern "C" {
#endif
#include "eb.h"
/*
@ -85,12 +81,4 @@ EB_Error_Code eb_forward_wide_alt_character(EB_Appendix *appendix, int n,
EB_Error_Code eb_backward_wide_alt_character(EB_Appendix *appendix, int n,
int *character_number);
/* for backward compatibility */
#define eb_suspend_appendix eb_unset_appendix_subbook
#define eb_initialize_all_appendix_subbooks eb_load_all_appendix_subbooks
#ifdef __cplusplus
}
#endif
#endif /* not EB_APPENDIX_H */

View File

@ -293,7 +293,6 @@ eb_load_all_appendix_subbooks(EB_Appendix *appendix)
EB_Appendix_Subbook *subbook;
int i;
eb_lock(&appendix->lock);
LOG(("in: eb_load_all_appendix_subbooks(appendix=%d)",
(int)appendix->code));
@ -336,7 +335,6 @@ eb_load_all_appendix_subbooks(EB_Appendix *appendix)
LOG(("out: eb_load_all_appendix_subbooks() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -346,7 +344,6 @@ eb_load_all_appendix_subbooks(EB_Appendix *appendix)
failed:
LOG(("out: eb_load_all_appendix_subbooks() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -362,7 +359,6 @@ eb_appendix_subbook_list(EB_Appendix *appendix, EB_Subbook_Code *subbook_list,
EB_Subbook_Code *list_p;
int i;
eb_lock(&appendix->lock);
LOG(("in: eb_appendix_subbook_list(appendix=%d)", (int)appendix->code));
/*
@ -383,7 +379,6 @@ eb_appendix_subbook_list(EB_Appendix *appendix, EB_Subbook_Code *subbook_list,
LOG(("out: eb_appendix_subbook_list(subbook_count=%d) = %s",
*subbook_count, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -393,7 +388,6 @@ eb_appendix_subbook_list(EB_Appendix *appendix, EB_Subbook_Code *subbook_list,
failed:
*subbook_count = 0;
LOG(("out: eb_appendix_subbook_list() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -406,7 +400,6 @@ eb_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code *subbook_code)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_appendix_subbook(appendix=%d)", (int)appendix->code));
/*
@ -424,7 +417,6 @@ eb_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code *subbook_code)
LOG(("out: eb_appendix_subbook(subbook=%d) = %s", (int)*subbook_code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -434,7 +426,6 @@ eb_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code *subbook_code)
failed:
*subbook_code = EB_SUBBOOK_INVALID;
LOG(("out: eb_appendix_subbook() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -447,7 +438,6 @@ eb_appendix_subbook_directory(EB_Appendix *appendix, char *directory)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_appendix_subbook_directory(appendix=%d)",
(int)appendix->code));
@ -466,7 +456,6 @@ eb_appendix_subbook_directory(EB_Appendix *appendix, char *directory)
LOG(("out: eb_appendix_subbook_directory(directory=%s) = %s",
directory, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -477,7 +466,6 @@ eb_appendix_subbook_directory(EB_Appendix *appendix, char *directory)
*directory = '\0';
LOG(("out: eb_appendix_subbook_directory() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -491,7 +479,6 @@ eb_appendix_subbook_directory2(EB_Appendix *appendix,
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_appendix_subbook_directory2(appendix=%d, subbook=%d)",
(int)appendix->code, (int)subbook_code));
@ -518,7 +505,6 @@ eb_appendix_subbook_directory2(EB_Appendix *appendix,
LOG(("out: eb_appendix_subbook_directory2(directory=%s) = %s",
directory, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -529,7 +515,6 @@ eb_appendix_subbook_directory2(EB_Appendix *appendix,
*directory = '\0';
LOG(("out: eb_appendix_subbook_directory2() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -542,7 +527,6 @@ eb_set_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code subbook_code)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_set_appendix_subbook(appendix=%d, subbook=%d)",
(int)appendix->code, (int)subbook_code));
@ -592,7 +576,6 @@ eb_set_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code subbook_code)
succeeded:
LOG(("out: eb_set_appendix_subbook() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -604,7 +587,6 @@ eb_set_appendix_subbook(EB_Appendix *appendix, EB_Subbook_Code subbook_code)
zio_close(&appendix->subbook_current->zio);
appendix->subbook_current = NULL;
LOG(("out: eb_set_appendix_subbook() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -732,7 +714,6 @@ eb_set_appendix_subbook_epwing(EB_Appendix *appendix,
void
eb_unset_appendix_subbook(EB_Appendix *appendix)
{
eb_lock(&appendix->lock);
LOG(("in: eb_unset_appendix_subbook(appendix=%d)", (int)appendix->code));
/*
@ -744,5 +725,4 @@ eb_unset_appendix_subbook(EB_Appendix *appendix)
}
LOG(("out: eb_unset_appendix_subbook()"));
eb_unlock(&appendix->lock);
}

View File

@ -161,7 +161,6 @@ eb_set_binary_mono_graphic(EB_Book *book, const EB_Position *position,
size_t data_size;
size_t file_size;
eb_lock(&book->lock);
LOG(("in: eb_set_binary_mono_graphic(book=%d, position={%d,%d}, \
width=%d, height=%d)",
(int)book->code, position->page, position->offset, width, height));
@ -307,7 +306,6 @@ width=%d, height=%d)",
LOG(("out: eb_set_binary_mono_graphic() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -318,7 +316,6 @@ width=%d, height=%d)",
eb_reset_binary_context(book);
LOG(("out: eb_set_binary_mono_graphic() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -414,7 +411,6 @@ eb_set_binary_gray_graphic(EB_Book *book, const EB_Position *position,
size_t data_size;
size_t file_size;
eb_lock(&book->lock);
LOG(("in: eb_set_binary_gray_graphic(book=%d, position={%d,%d}, \
width=%d, height=%d)",
(int)book->code, position->page, position->offset, width, height));
@ -556,7 +552,6 @@ width=%d, height=%d)",
LOG(("out: eb_set_binary_gray_graphic() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -567,7 +562,6 @@ width=%d, height=%d)",
eb_reset_binary_context(book);
LOG(("out: eb_set_binary_gray_graphic() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -585,7 +579,6 @@ eb_set_binary_wave(EB_Book *book, const EB_Position *start_position,
off_t end_location;
char temporary_buffer[4];
eb_lock(&book->lock);
LOG(("in: eb_set_binary_wave(book=%d, start_position={%d,%d}, \
end_position={%d,%d})",
(int)book->code, start_position->page, start_position->offset,
@ -724,7 +717,6 @@ end_position={%d,%d})",
memcpy(context->cache_buffer + 8, "WAVE", 4);
LOG(("out: eb_set_binary_wave() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -734,7 +726,6 @@ end_position={%d,%d})",
failed:
eb_reset_binary_context(book);
LOG(("out: eb_set_binary_wave() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -754,7 +745,6 @@ eb_set_binary_color_graphic(EB_Book *book, const EB_Position *position)
EB_Binary_Context *context;
char buffer[EB_COLOR_GRAPHIC_HEADER_LENGTH];
eb_lock(&book->lock);
LOG(("in: eb_set_binary_color_graphic(book=%d, position={%d,%d})",
(int)book->code, position->page, position->offset));
@ -824,7 +814,6 @@ eb_set_binary_color_graphic(EB_Book *book, const EB_Position *position)
LOG(("out: eb_set_binary_color_graphic() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -835,7 +824,6 @@ eb_set_binary_color_graphic(EB_Book *book, const EB_Position *position)
eb_reset_binary_context(book);
LOG(("out: eb_set_binary_color_graphic() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -856,7 +844,6 @@ eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv)
EB_Subbook *subbook;
Zio_Code zio_code;
eb_lock(&book->lock);
LOG(("in: eb_set_binary_mpeg(book=%d)", (int)book->code));
eb_reset_binary_context(book);
@ -904,7 +891,6 @@ eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv)
book->binary_context.cache_offset = 0;
LOG(("out: eb_set_binary_mpeg() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -914,7 +900,6 @@ eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv)
failed:
eb_reset_binary_context(book);
LOG(("out: eb_set_binary_mpeg() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -932,7 +917,6 @@ eb_read_binary(book, binary_max_length, binary, binary_length)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_read_binary(book=%d, binary_max_length=%ld)",
(int)book->code, (long)binary_max_length));
@ -976,7 +960,6 @@ eb_read_binary(book, binary_max_length, binary, binary_length)
LOG(("out: eb_read_binary(binary_length=%ld) = %s", (long)*binary_length,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -987,7 +970,6 @@ eb_read_binary(book, binary_max_length, binary, binary_length)
*binary_length = -1;
eb_reset_binary_context(book);
LOG(("out: eb_read_binary() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return error_code;
}
@ -1392,11 +1374,9 @@ eb_read_binary_gray_graphic(EB_Book *book, size_t binary_max_length,
void
eb_unset_binary(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_unset_binary(book=%d)", (int)book->code));
eb_reset_binary_context(book);
LOG(("out: eb_unset_binary()"));
eb_unlock(&book->lock);
}

View File

@ -29,10 +29,6 @@
#ifndef EB_BINARY_H
#define EB_BINARY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include "defs.h"
@ -62,8 +58,4 @@ EB_Error_Code eb_compose_movie_path_name(EB_Book *book,
EB_Error_Code eb_decompose_movie_file_name(unsigned int *argv,
const char *composed_file_name);
#ifdef __cplusplus
}
#endif
#endif /* not EB_BINARY_H */

18
book.c
View File

@ -69,7 +69,6 @@ eb_initialize_book(EB_Book *book)
eb_initialize_binary_context(book);
eb_initialize_search_contexts(book);
eb_initialize_binary_context(book);
eb_initialize_lock(&book->lock);
LOG(("out: eb_initialize_book()"));
}
@ -84,7 +83,6 @@ eb_bind(EB_Book *book, const char *path)
EB_Error_Code error_code;
char temporary_path[EB_MAX_PATH_LENGTH + 1];
eb_lock(&book->lock);
LOG(("in: eb_bind(path=%s)", path));
/*
@ -98,9 +96,7 @@ eb_bind(EB_Book *book, const char *path)
/*
* Assign a book code.
*/
pthread_mutex_lock(&book_counter_mutex);
book->code = book_counter++;
pthread_mutex_unlock(&book_counter_mutex);
/*
* Set the path of the book.
@ -145,7 +141,6 @@ eb_bind(EB_Book *book, const char *path)
LOG(("out: eb_bind(book=%d) = %s", (int)book->code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -154,7 +149,6 @@ eb_bind(EB_Book *book, const char *path)
failed:
eb_finalize_book(book);
LOG(("out: eb_bind() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -180,7 +174,6 @@ eb_finalize_book(EB_Book *book)
eb_finalize_binary_context(book);
eb_finalize_search_contexts(book);
eb_finalize_binary_context(book);
eb_finalize_lock(&book->lock);
if (book->path != NULL)
free(book->path);
@ -817,7 +810,6 @@ eb_is_bound(EB_Book *book)
{
int is_bound;
eb_lock(&book->lock);
LOG(("in: eb_is_bound(book=%d)", (int)book->code));
/*
@ -826,7 +818,6 @@ eb_is_bound(EB_Book *book)
is_bound = (book->path != NULL);
LOG(("out: eb_is_bound() = %d", is_bound));
eb_unlock(&book->lock);
return is_bound;
}
@ -840,7 +831,6 @@ eb_path(EB_Book *book, char *path)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_path(book=%d)", (int)book->code));
/*
@ -857,7 +847,6 @@ eb_path(EB_Book *book, char *path)
strcpy(path, book->path);
LOG(("out: eb_path(path=%s) = %s", path, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -867,7 +856,6 @@ eb_path(EB_Book *book, char *path)
failed:
*path = '\0';
LOG(("out: eb_path() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -880,7 +868,6 @@ eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_disc_type(book=%d)", (int)book->code));
/*
@ -898,7 +885,6 @@ eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code)
LOG(("out: eb_disc_type(disc_code=%d) = %s", (int)*disc_code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -908,7 +894,6 @@ eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code)
failed:
*disc_code = EB_DISC_INVALID;
LOG(("out: eb_disc_type() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -921,7 +906,6 @@ eb_character_code(EB_Book *book, EB_Character_Code *character_code)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_character_code(book=%d)", (int)book->code));
/*
@ -939,7 +923,6 @@ eb_character_code(EB_Book *book, EB_Character_Code *character_code)
LOG(("out: eb_character_code(character_code=%d) = %s",
(int)*character_code, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -949,6 +932,5 @@ eb_character_code(EB_Book *book, EB_Character_Code *character_code)
failed:
*character_code = EB_CHARCODE_INVALID;
LOG(("out: eb_character_code() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -52,7 +52,6 @@ eb_initialize_booklist(EB_BookList *booklist)
booklist->entry_count = 0;
booklist->max_entry_count = 0;
booklist->entries = NULL;
eb_initialize_lock(&booklist->lock);
LOG(("out: eb_initialize_booklist()"));
}
@ -160,7 +159,6 @@ eb_booklist_book_count(EB_BookList *booklist, int *book_count)
{
EB_Error_Code error_code;
eb_lock(&booklist->lock);
LOG(("in: eb_booklist_book_count(booklist=%d)", (int)booklist->code));
if (booklist->entries == NULL) {
@ -171,7 +169,6 @@ eb_booklist_book_count(EB_BookList *booklist, int *book_count)
LOG(("out: eb_booklist_book_count(count=%d) = %s", *book_count,
eb_error_string(EB_SUCCESS)));
eb_unlock(&booklist->lock);
return EB_SUCCESS;
/*
@ -179,7 +176,6 @@ eb_booklist_book_count(EB_BookList *booklist, int *book_count)
*/
failed:
LOG(("out: eb_booklist_book_count() = %s", eb_error_string(error_code)));
eb_unlock(&booklist->lock);
return error_code;
}
@ -192,7 +188,6 @@ eb_booklist_book_name(EB_BookList *booklist, int book_index, char **book_name)
{
EB_Error_Code error_code;
eb_lock(&booklist->lock);
LOG(("in: eb_booklist_book_name(booklist=%d,index=%d)",
(int)booklist->code, book_index));
@ -211,7 +206,6 @@ eb_booklist_book_name(EB_BookList *booklist, int book_index, char **book_name)
(*book_name == NULL) ? "NULL" : *book_name,
eb_error_string(EB_SUCCESS)));
eb_unlock(&booklist->lock);
return EB_SUCCESS;
/*
@ -219,7 +213,6 @@ eb_booklist_book_name(EB_BookList *booklist, int book_index, char **book_name)
*/
failed:
LOG(("out: eb_booklist_book_name() = %s", eb_error_string(error_code)));
eb_unlock(&booklist->lock);
return error_code;
}
@ -233,7 +226,6 @@ eb_booklist_book_title(EB_BookList *booklist, int book_index,
{
EB_Error_Code error_code;
eb_lock(&booklist->lock);
LOG(("in: eb_booklist_book_title(booklist=%d,index=%d)",
(int)booklist->code, book_index));
@ -251,7 +243,6 @@ eb_booklist_book_title(EB_BookList *booklist, int book_index,
(*book_title == NULL) ? "NULL" : *book_title,
eb_error_string(EB_SUCCESS)));
eb_unlock(&booklist->lock);
return EB_SUCCESS;
/*
@ -259,6 +250,5 @@ eb_booklist_book_title(EB_BookList *booklist, int book_index,
*/
failed:
LOG(("out: eb_booklist_book_title() = %s", eb_error_string(error_code)));
eb_unlock(&booklist->lock);
return error_code;
}

View File

@ -29,10 +29,6 @@
#ifndef EB_BOOKLIST_H
#define EB_BOOKLIST_H
#ifdef __cplusplus
extern "C" {
#endif
#include "eb.h"
/*
@ -49,8 +45,4 @@ EB_Error_Code eb_booklist_book_title(EB_BookList *booklist, int book_index,
char **book_title);
#ifdef __cplusplus
}
#endif
#endif /* not EB_BOOKLIST_H */

View File

@ -36,15 +36,6 @@
*/
#define EB_TEXT_DOMAIN_NAME "eb"
/*
* Locale directory.
*/
#ifndef WIN32
#define EB_LOCALEDIR "@localedir@"
#else
#define EB_LOCALEDIR localedir()
#endif
/*
* Data size of a book entry in a catalog file.
*/
@ -260,19 +251,6 @@ void eb_initialize_default_hookset(void);
void eb_jisx0208_to_euc(char *out_string, const char *in_string);
void eb_sjis_to_euc(char *out_string, const char *in_string);
/* lock.c */
#ifdef ENABLE_PTHREAD
void eb_initialize_lock(EB_Lock *lock);
void eb_finalize_lock(EB_Lock *lock);
void eb_lock(EB_Lock *lock);
void eb_unlock(EB_Lock *lock);
#else /* not ENABLE_PTHREAD */
#define eb_lock(x)
#define eb_unlock(x)
#define eb_initialize_lock(x)
#define eb_finalize_lock(x)
#endif /* not ENABLE_PTHREAD */
/* log.c */
void eb_initialize_log(void);
const char *eb_quoted_stream(const char *stream, size_t stream_length);

View File

@ -42,14 +42,6 @@
#include <fcntl.h>
#include <sys/time.h>
/*
* Mutual exclusion lock of Pthreads.
*/
#ifndef ENABLE_PTHREAD
#define pthread_mutex_lock(m)
#define pthread_mutex_unlock(m)
#endif
/*
* stat() macros.
*/
@ -85,17 +77,8 @@
/*
* Tricks for gettext.
*/
#ifdef ENABLE_NLS
#define _(string) gettext(string)
#ifdef gettext_noop
#define N_(string) gettext_noop(string)
#else
#define N_(string) (string)
#endif
#else
#define _(string) (string)
#define N_(string) (string)
#endif
/*
* Fake missing function names.

View File

@ -38,7 +38,6 @@
int
eb_have_copyright(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_copyright(book=%d)", (int)book->code));
/*
@ -54,7 +53,6 @@ eb_have_copyright(EB_Book *book)
goto failed;
LOG(("out: eb_have_copyright() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -63,7 +61,6 @@ eb_have_copyright(EB_Book *book)
*/
failed:
LOG(("out: eb_have_copyright() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -77,7 +74,6 @@ eb_copyright(EB_Book *book, EB_Position *position)
EB_Error_Code error_code;
int page;
eb_lock(&book->lock);
LOG(("in: eb_copyright(book=%d)", (int)book->code));
/*
@ -105,7 +101,6 @@ eb_copyright(EB_Book *book, EB_Position *position)
LOG(("out: eb_copyright(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -114,6 +109,5 @@ eb_copyright(EB_Book *book, EB_Position *position)
*/
failed:
LOG(("out: eb_copyright() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -38,7 +38,6 @@
int
eb_have_cross_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_cross_search(book=%d)", (int)book->code));
/*
@ -51,7 +50,6 @@ eb_have_cross_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_cross_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -60,7 +58,6 @@ eb_have_cross_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_cross_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -80,7 +77,6 @@ eb_search_cross(EB_Book *book, const char * const input_words[])
/*
* Lock the book.
*/
eb_lock(&book->lock);
LOG(("in: eb_search_cross(book=%d, input_words=[below])",
(int)book->code));
@ -173,7 +169,6 @@ eb_search_cross(EB_Book *book, const char * const input_words[])
(book->search_contexts + i)->code = EB_SEARCH_NONE;
LOG(("out: eb_search_cross() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -183,6 +178,5 @@ eb_search_cross(EB_Book *book, const char * const input_words[])
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_cross() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

61
defs.h
View File

@ -29,17 +29,11 @@
#ifndef EB_DEFS_H
#define EB_DEFS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <limits.h>
#include "zio.h"
#include <pthread.h>
/*
* Disc code
*/
@ -95,13 +89,7 @@ extern "C" {
/*
* Maximum length of a word to be searched.
*/
#if defined(PATH_MAX)
#define EB_MAX_PATH_LENGTH PATH_MAX
#elif defined(MAXPATHLEN)
#define EB_MAX_PATH_LENGTH MAXPATHLEN
#else
#define EB_MAX_PATH_LENGTH 1024
#endif
/*
* Maximum length of a directory name.
@ -193,11 +181,11 @@ typedef int EB_Text_Status_Code;
typedef int EB_Multi_Search_Code;
typedef int EB_Hook_Code;
typedef int EB_Binary_Code;
typedef int EB_Multi_Entry_Code;
/*
* Typedef for Structures.
*/
typedef struct EB_Lock_Struct EB_Lock;
typedef struct EB_Position_Struct EB_Position;
typedef struct EB_Alternation_Cache_Struct EB_Alternation_Cache;
typedef struct EB_Appendix_Subbook_Struct EB_Appendix_Subbook;
@ -216,26 +204,6 @@ typedef struct EB_Hookset_Struct EB_Hookset;
typedef struct EB_BookList_Entry EB_BookList_Entry;
typedef struct EB_BookList EB_BookList;
/*
* Pthreads lock.
*/
struct EB_Lock_Struct {
/*
* Lock count. (For emulating recursive lock).
*/
int lock_count;
/*
* Mutex for `lock_count'.
*/
pthread_mutex_t lock_count_mutex;
/*
* Mutex for struct entity.
*/
pthread_mutex_t entity_mutex;
};
/*
* A pair of page and offset.
*/
@ -370,11 +338,6 @@ struct EB_Appendix_Struct {
*/
EB_Appendix_Subbook *subbook_current;
/*
* Lock.
*/
EB_Lock lock;
/*
* Cache table for alternation text.
*/
@ -896,11 +859,6 @@ struct EB_Book_Struct {
* Context parameters for text reading.
*/
EB_Search_Context search_contexts[EB_NUMBER_OF_SEARCH_CONTEXTS];
/*
* Lock.
*/
EB_Lock lock;
};
/*
@ -944,11 +902,6 @@ struct EB_Hookset_Struct {
* List of hooks.
*/
EB_Hook hooks[EB_NUMBER_OF_HOOKS];
/*
* Lock.
*/
EB_Lock lock;
};
/*
@ -989,18 +942,6 @@ struct EB_BookList {
* Book entries.
*/
EB_BookList_Entry *entries;
/*
* Lock.
*/
EB_Lock lock;
};
/* for backward compatibility */
#define EB_Multi_Entry_Code int
#ifdef __cplusplus
}
#endif
#endif /* not EB_DEFS_H */

12
eb.h
View File

@ -29,10 +29,6 @@
#ifndef EB_EB_H
#define EB_EB_H
#ifdef __cplusplus
extern "C" {
#endif
#include "defs.h"
#include <stdarg.h>
@ -146,12 +142,4 @@ EB_Error_Code eb_search_all_alphabet(EB_Book* book);
EB_Error_Code eb_search_all_kana(EB_Book* book);
EB_Error_Code eb_search_all_asis(EB_Book* book);
/* for backward compatibility */
#define eb_suspend eb_unset_subbook
#define eb_initialize_all_subbooks eb_load_all_subbooks
#ifdef __cplusplus
}
#endif
#endif /* not EB_EB_H */

View File

@ -38,7 +38,6 @@
int
eb_have_endword_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_endword_search(book=%d)", (int)book->code));
/*
@ -56,7 +55,6 @@ eb_have_endword_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_endword_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -65,7 +63,6 @@ eb_have_endword_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_endword_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -80,7 +77,6 @@ eb_search_endword(EB_Book *book, const char *input_word)
EB_Word_Code word_code;
EB_Search_Context *context;
eb_lock(&book->lock);
LOG(("in: eb_search_endword(book=%d, input_word=%s)", (int)book->code,
eb_quoted_string(input_word)));
@ -174,7 +170,6 @@ eb_search_endword(EB_Book *book, const char *input_word)
goto failed;
LOG(("out: eb_search_endword() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -184,6 +179,5 @@ eb_search_endword(EB_Book *book, const char *input_word)
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_endword() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -29,10 +29,6 @@
#ifndef EB_ERROR_H
#define EB_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif
#include "defs.h"
/*
@ -135,8 +131,4 @@ extern "C" {
const char *eb_error_string(EB_Error_Code error_code);
const char *eb_error_message(EB_Error_Code error_code);
#ifdef __cplusplus
}
#endif
#endif /* not EB_ERROR_H */

View File

@ -38,7 +38,6 @@
int
eb_have_exactword_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_exactword_search(book=%d)", (int)book->code));
/*
@ -56,7 +55,6 @@ eb_have_exactword_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_exactword_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -65,7 +63,6 @@ eb_have_exactword_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_exactword_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -80,7 +77,6 @@ eb_search_exactword(EB_Book *book, const char *input_word)
EB_Word_Code word_code;
EB_Search_Context *context;
eb_lock(&book->lock);
LOG(("in: eb_search_exactword(book=%d, input_word=%s)", (int)book->code,
eb_quoted_string(input_word)));
@ -173,7 +169,6 @@ eb_search_exactword(EB_Book *book, const char *input_word)
goto failed;
LOG(("out: eb_search_exactword() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -183,6 +178,5 @@ eb_search_exactword(EB_Book *book, const char *input_word)
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_exactword() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -489,7 +489,6 @@ eb_compose_movie_path_name(EB_Book *book, const unsigned int *argv,
/*
* Lock the book.
*/
eb_lock(&book->lock);
LOG(("in: eb_compose_movie_path_name(book=%d, argv=%x)",
(int)book->code, argv));
@ -516,7 +515,6 @@ eb_compose_movie_path_name(EB_Book *book, const unsigned int *argv,
LOG(("out: eb_compse_movie_path_name() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -525,7 +523,6 @@ eb_compose_movie_path_name(EB_Book *book, const unsigned int *argv,
failed:
LOG(("out: eb_compse_movie_path_name() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

16
font.c
View File

@ -165,7 +165,6 @@ eb_font(EB_Book *book, EB_Font_Code *font_code)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_font(book=%d)", (int)book->code));
/*
@ -190,7 +189,6 @@ eb_font(EB_Book *book, EB_Font_Code *font_code)
LOG(("out: eb_font(font_code=%d) = %s", (int)*font_code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -200,7 +198,6 @@ eb_font(EB_Book *book, EB_Font_Code *font_code)
failed:
*font_code = EB_FONT_INVALID;
LOG(("out: eb_font() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -215,7 +212,6 @@ eb_set_font(EB_Book *book, EB_Font_Code font_code)
EB_Error_Code error_code;
EB_Subbook *subbook;
eb_lock(&book->lock);
LOG(("in: eb_set_font(book=%d, font_code=%d)", (int)book->code,
(int)font_code));
@ -285,7 +281,6 @@ eb_set_font(EB_Book *book, EB_Font_Code font_code)
succeeded:
LOG(("out: eb_set_font() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -307,7 +302,6 @@ eb_unset_font(EB_Book *book)
{
EB_Subbook *subbook;
eb_lock(&book->lock);
LOG(("in: eb_unset_font(book=%d)", (int)book->code));
subbook = book->subbook_current;
@ -338,7 +332,6 @@ eb_unset_font(EB_Book *book)
succeeded:
LOG(("out: eb_unset_font()"));
eb_unlock(&book->lock);
}
@ -353,7 +346,6 @@ eb_font_list(EB_Book *book, EB_Font_Code *font_list, int *font_count)
EB_Font_Code *list_p;
int i;
eb_lock(&book->lock);
LOG(("in: eb_font_list(book=%d)", (int)book->code));
/*
@ -381,7 +373,6 @@ eb_font_list(EB_Book *book, EB_Font_Code *font_list, int *font_count)
LOG(("out: eb_font(font_count=%d) = %s", *font_count,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -390,7 +381,6 @@ eb_font_list(EB_Book *book, EB_Font_Code *font_list, int *font_count)
*/
failed:
LOG(("out: eb_font_list() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -404,7 +394,6 @@ eb_have_font(EB_Book *book, EB_Font_Code font_code)
{
EB_Subbook *subbook;
eb_lock(&book->lock);
LOG(("in: eb_have_font(book=%d, font_code=%d)", (int)book->code,
(int)font_code));
@ -426,7 +415,6 @@ eb_have_font(EB_Book *book, EB_Font_Code font_code)
goto failed;
LOG(("out: eb_have_font() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -435,7 +423,6 @@ eb_have_font(EB_Book *book, EB_Font_Code font_code)
*/
failed:
LOG(("out: eb_have_font() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -449,7 +436,6 @@ eb_font_height(EB_Book *book, int *height)
EB_Error_Code error_code;
EB_Font_Code font_code;
eb_lock(&book->lock);
LOG(("in: eb_font_height(book=%d)", (int)book->code));
/*
@ -481,7 +467,6 @@ eb_font_height(EB_Book *book, int *height)
LOG(("out: eb_font_heigt(height=%d) = %s", *height,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -491,7 +476,6 @@ eb_font_height(EB_Book *book, int *height)
failed:
*height = 0;
LOG(("out: eb_font_height() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

8
font.h
View File

@ -29,10 +29,6 @@
#ifndef EB_FONT_H
#define EB_FONT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include "defs.h"
@ -189,8 +185,4 @@ EB_Error_Code eb_forward_wide_font_character(EB_Book *book, int n,
EB_Error_Code eb_backward_wide_font_character(EB_Book *book, int n,
int *character_number);
#ifdef __cplusplus
}
#endif
#endif /* not EB_FONT_H */

8
hook.c
View File

@ -63,7 +63,6 @@ eb_initialize_hookset(EB_Hookset *hookset)
LOG(("in: eb_initialize_hookset()"));
eb_initialize_lock(&hookset->lock);
for (i = 0; i < EB_NUMBER_OF_HOOKS; i++) {
hookset->hooks[i].code = i;
@ -96,7 +95,6 @@ eb_finalize_hookset(EB_Hookset *hookset)
hookset->hooks[i].code = i;
hookset->hooks[i].function = NULL;
}
eb_finalize_lock(&hookset->lock);
LOG(("out: eb_finalize_hookset()"));
}
@ -110,7 +108,6 @@ eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook)
{
EB_Error_Code error_code;
eb_lock(&hookset->lock);
LOG(("in: eb_set_hook(hook=%d)", (int)hook->code));
/*
@ -123,7 +120,6 @@ eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook)
hookset->hooks[hook->code].function = hook->function;
LOG(("out: eb_set_hook() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&hookset->lock);
return EB_SUCCESS;
@ -132,7 +128,6 @@ eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook)
*/
failed:
LOG(("out: eb_set_hook() = %s", eb_error_string(error_code)));
eb_unlock(&hookset->lock);
return error_code;
}
@ -146,7 +141,6 @@ eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook)
EB_Error_Code error_code;
const EB_Hook *h;
eb_lock(&hookset->lock);
LOG(("in: eb_set_hooks(hooks=[below])"));
if (eb_log_flag) {
@ -169,7 +163,6 @@ eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook)
* Unlock the hookset.
*/
LOG(("out: eb_set_hooks() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&hookset->lock);
return EB_SUCCESS;
@ -178,7 +171,6 @@ eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook)
*/
failed:
LOG(("out: eb_set_hooks() = %s", eb_error_string(error_code)));
eb_unlock(&hookset->lock);
return error_code;
}

View File

@ -38,7 +38,6 @@
int
eb_have_keyword_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_keyword_search(book=%d)", (int)book->code));
/*
@ -51,7 +50,6 @@ eb_have_keyword_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_keyword_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -60,7 +58,6 @@ eb_have_keyword_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_keyword_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -80,7 +77,6 @@ eb_search_keyword(EB_Book *book, const char * const input_words[])
/*
* Lock the book.
*/
eb_lock(&book->lock);
LOG(("in: eb_search_keyword(book=%d, input_words=[below])",
(int)book->code));
@ -174,7 +170,6 @@ eb_search_keyword(EB_Book *book, const char * const input_words[])
(book->search_contexts + i)->code = EB_SEARCH_NONE;
LOG(("out: eb_search_keyword() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -184,6 +179,5 @@ eb_search_keyword(EB_Book *book, const char * const input_words[])
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_keyword() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

2
log.c
View File

@ -121,7 +121,6 @@ eb_log(const char *message, ...)
void
eb_log_stderr(const char *message, va_list ap)
{
pthread_mutex_lock(&log_mutex);
fputs("[EB] ", stderr);
@ -129,7 +128,6 @@ eb_log_stderr(const char *message, va_list ap)
fputc('\n', stderr);
fflush(stderr);
pthread_mutex_unlock(&log_mutex);
}
#define MAX_QUOTED_STREAM_LENGTH 100

12
menu.c
View File

@ -38,7 +38,6 @@
int
eb_have_menu(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_menu(book=%d)", (int)book->code));
/*
@ -54,7 +53,6 @@ eb_have_menu(EB_Book *book)
goto failed;
LOG(("out: eb_have_menu() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -63,7 +61,6 @@ eb_have_menu(EB_Book *book)
*/
failed:
LOG(("out: eb_have_menu() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -77,7 +74,6 @@ eb_menu(EB_Book *book, EB_Position *position)
EB_Error_Code error_code;
int page;
eb_lock(&book->lock);
LOG(("in: eb_menu(book=%d)", (int)book->code));
/*
@ -105,7 +101,6 @@ eb_menu(EB_Book *book, EB_Position *position)
LOG(("out: eb_menu(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -114,7 +109,6 @@ eb_menu(EB_Book *book, EB_Position *position)
*/
failed:
LOG(("out: eb_menu() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -125,7 +119,6 @@ eb_menu(EB_Book *book, EB_Position *position)
int
eb_have_image_menu(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_image_menu(book=%d)", (int)book->code));
/*
@ -141,7 +134,6 @@ eb_have_image_menu(EB_Book *book)
goto failed;
LOG(("out: eb_have_image_menu() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -150,7 +142,6 @@ eb_have_image_menu(EB_Book *book)
*/
failed:
LOG(("out: eb_have_image_menu() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -164,7 +155,6 @@ eb_image_menu(EB_Book *book, EB_Position *position)
EB_Error_Code error_code;
int page;
eb_lock(&book->lock);
LOG(("in: eb_image_menu(book=%d)", (int)book->code));
/*
@ -192,7 +182,6 @@ eb_image_menu(EB_Book *book, EB_Position *position)
LOG(("out: eb_image_menu(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -201,6 +190,5 @@ eb_image_menu(EB_Book *book, EB_Position *position)
*/
failed:
LOG(("out: eb_image_menu() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

24
multi.c
View File

@ -286,7 +286,6 @@ succeeded:
int
eb_have_multi_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_multi_search(book=%d)", (int)book->code));
/*
@ -299,7 +298,6 @@ eb_have_multi_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_multi_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -308,7 +306,6 @@ eb_have_multi_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_multi_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -322,7 +319,6 @@ eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id, char *title)
EB_Error_Code error_code;
EB_Subbook *subbook;
eb_lock(&book->lock);
LOG(("in: eb_multi_title(book=%d, multi_id=%d)",
(int)book->code, (int)multi_id));
@ -355,7 +351,6 @@ eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id, char *title)
LOG(("out: eb_multi_title(title=%s) = %s", title,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -365,7 +360,6 @@ eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id, char *title)
failed:
*title = '\0';
LOG(("out: eb_multi_title() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -381,7 +375,6 @@ eb_multi_search_list(EB_Book *book, EB_Multi_Search_Code *search_list,
EB_Subbook_Code *list_p;
int i;
eb_lock(&book->lock);
LOG(("in: eb_multi_search_list(book=%d)", (int)book->code));
/*
@ -406,7 +399,6 @@ eb_multi_search_list(EB_Book *book, EB_Multi_Search_Code *search_list,
LOG(("out: eb_multi_search_list(search_count=%d) = %s", *search_count,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -416,7 +408,6 @@ eb_multi_search_list(EB_Book *book, EB_Multi_Search_Code *search_list,
failed:
*search_count = 0;
LOG(("out: eb_multi_search_list() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -430,7 +421,6 @@ eb_multi_entry_count(EB_Book *book, EB_Multi_Search_Code multi_id,
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_multi_entry_count(book=%d, multi_id=%d)", (int)book->code,
(int)multi_id));
@ -462,7 +452,6 @@ eb_multi_entry_count(EB_Book *book, EB_Multi_Search_Code multi_id,
LOG(("out: eb_multi_entry_count(entry_count=%d) = %s", (int)*entry_count,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -472,7 +461,6 @@ eb_multi_entry_count(EB_Book *book, EB_Multi_Search_Code multi_id,
failed:
*entry_count = 0;
LOG(("out: eb_multi_entry_count() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -510,7 +498,6 @@ eb_multi_entry_label(EB_Book *book, EB_Multi_Search_Code multi_id,
EB_Error_Code error_code;
EB_Subbook *subbook;
eb_lock(&book->lock);
LOG(("in: eb_multi_entry_label(book=%d, multi_id=%d, entry_index=%d)",
(int)book->code, (int)multi_id, entry_index));
@ -552,7 +539,6 @@ eb_multi_entry_label(EB_Book *book, EB_Multi_Search_Code multi_id,
LOG(("out: eb_multi_entry_label(label=%s) = %s", label,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -562,7 +548,6 @@ eb_multi_entry_label(EB_Book *book, EB_Multi_Search_Code multi_id,
failed:
*label = '\0';
LOG(("out: eb_multi_entry_label() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -577,7 +562,6 @@ eb_multi_entry_have_candidates(EB_Book *book, EB_Multi_Search_Code multi_id,
{
EB_Multi_Search *multi;
eb_lock(&book->lock);
LOG(("in: eb_multi_entry_have_candidates(book=%d, multi_id=%d, \
entry_index=%d)",
(int)book->code, (int)multi_id, entry_index));
@ -611,7 +595,6 @@ entry_index=%d)",
goto failed;
LOG(("out: eb_multi_entry_have_candidates() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -620,7 +603,6 @@ entry_index=%d)",
*/
failed:
LOG(("out: eb_multi_entry_have_candidates() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -636,7 +618,6 @@ eb_multi_entry_candidates(EB_Book *book, EB_Multi_Search_Code multi_id,
EB_Error_Code error_code;
EB_Multi_Search *multi;
eb_lock(&book->lock);
LOG(("in: eb_multi_entry_candidates(book=%d, multi_id=%d, entry_index=%d)",
(int)book->code, (int)multi_id, entry_index));
@ -683,7 +664,6 @@ eb_multi_entry_candidates(EB_Book *book, EB_Multi_Search_Code multi_id,
LOG(("out: eb_multi_entry_candidates(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -693,7 +673,6 @@ eb_multi_entry_candidates(EB_Book *book, EB_Multi_Search_Code multi_id,
failed:
LOG(("out: eb_multi_entry_candidates() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -712,7 +691,6 @@ eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
int word_count;
int i;
eb_lock(&book->lock);
LOG(("in: eb_search_multi(book=%d, multi_id=%d, input_words=[below])",
(int)book->code, (int)multi_id));
@ -824,7 +802,6 @@ eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
(book->search_contexts + i)->code = EB_SEARCH_NONE;
LOG(("out: eb_search_multi() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -834,6 +811,5 @@ eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_multi() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -53,7 +53,6 @@ static EB_Error_Code eb_narrow_character_text_latin(EB_Appendix *appendix,
int
eb_have_narrow_alt(EB_Appendix *appendix)
{
eb_lock(&appendix->lock);
LOG(("in: eb_have_narrow_alt(appendix=%d)", (int)appendix->code));
/*
@ -66,7 +65,6 @@ eb_have_narrow_alt(EB_Appendix *appendix)
goto failed;
LOG(("out: eb_have_narrow_alt() = %d", 1));
eb_unlock(&appendix->lock);
return 1;
@ -75,7 +73,6 @@ eb_have_narrow_alt(EB_Appendix *appendix)
*/
failed:
LOG(("out: eb_have_narrow_alt() = %d", 0));
eb_unlock(&appendix->lock);
return 0;
}
@ -89,7 +86,6 @@ eb_narrow_alt_start(EB_Appendix *appendix, int *start)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_narrow_alt_start(appendix=%d)", (int)appendix->code));
/*
@ -109,7 +105,6 @@ eb_narrow_alt_start(EB_Appendix *appendix, int *start)
LOG(("out: eb_narrow_alt_start(start=%d) = %s", *start,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -119,7 +114,6 @@ eb_narrow_alt_start(EB_Appendix *appendix, int *start)
failed:
*start = -1;
LOG(("out: eb_narrow_alt_start() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -133,7 +127,6 @@ eb_narrow_alt_end(EB_Appendix *appendix, int *end)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_narrow_alt_end(appendix=%d)", (int)appendix->code));
/*
@ -153,7 +146,6 @@ eb_narrow_alt_end(EB_Appendix *appendix, int *end)
LOG(("out: eb_narrow_alt_end(end=%d) = %s", *end,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -163,7 +155,6 @@ eb_narrow_alt_end(EB_Appendix *appendix, int *end)
failed:
*end = -1;
LOG(("out: eb_narrow_alt_end() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -177,7 +168,6 @@ eb_narrow_alt_character_text(EB_Appendix *appendix, int character_number,
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_narrow_alt_character_text(appendix=%d, character_number=%d)",
(int)appendix->code, character_number));
@ -209,7 +199,6 @@ eb_narrow_alt_character_text(EB_Appendix *appendix, int character_number,
LOG(("out: eb_narrow_alt_character_text(text=%s) = %s",
eb_quoted_string(text), eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -220,7 +209,6 @@ eb_narrow_alt_character_text(EB_Appendix *appendix, int character_number,
*text = '\0';
LOG(("out: eb_narrow_alt_character_text() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -422,7 +410,6 @@ eb_forward_narrow_alt_character(EB_Appendix *appendix, int n,
character_number);
}
eb_lock(&appendix->lock);
LOG(("in: eb_forward_narrow_alt_character(appendix=%d, n=%d, \
character_number=%d)",
(int)appendix->code, n, *character_number));
@ -500,7 +487,6 @@ character_number=%d)",
LOG(("out: eb_forkward_narrow_alt_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -511,7 +497,6 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_forward_narrow_alt_character() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -532,7 +517,6 @@ eb_backward_narrow_alt_character(EB_Appendix *appendix, int n,
return eb_forward_narrow_alt_character(appendix, -n, character_number);
}
eb_lock(&appendix->lock);
LOG(("in: eb_backward_narrow_alt_character(appendix=%d, n=%d, \
character_number=%d)",
(int)appendix->code, n, *character_number));
@ -610,7 +594,6 @@ character_number=%d)",
LOG(("out: eb_backward_narrow_alt_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -621,6 +604,5 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_backward_narrow_alt_character() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}

View File

@ -313,7 +313,6 @@ eb_have_narrow_font(EB_Book *book)
{
int i;
eb_lock(&book->lock);
LOG(("in: eb_have_narrow_font(book=%d)", (int)book->code));
/*
@ -342,7 +341,6 @@ eb_have_narrow_font(EB_Book *book)
succeeded:
LOG(("out: eb_have_narrow_font() = %d", 1));
eb_unlock(&book->lock);
return 1;
/*
@ -350,7 +348,6 @@ eb_have_narrow_font(EB_Book *book)
*/
failed:
LOG(("out: eb_have_narrow_font() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -364,7 +361,6 @@ eb_narrow_font_width(EB_Book *book, int *width)
EB_Error_Code error_code;
EB_Font_Code font_code;
eb_lock(&book->lock);
LOG(("in: eb_narrow_font_width(book=%d)", (int)book->code));
/*
@ -393,7 +389,6 @@ eb_narrow_font_width(EB_Book *book, int *width)
LOG(("out: eb_narrow_font_width(width=%d) = %s", (int)*width,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -403,7 +398,6 @@ eb_narrow_font_width(EB_Book *book, int *width)
failed:
*width = 0;
LOG(("out: eb_narrow_font_width() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -463,7 +457,6 @@ eb_narrow_font_size(EB_Book *book, size_t *size)
int width;
int height;
eb_lock(&book->lock);
LOG(("in: eb_narrow_font_size(book=%d)", (int)book->code));
/*
@ -496,7 +489,6 @@ eb_narrow_font_size(EB_Book *book, size_t *size)
LOG(("out: eb_narrow_font_size(size=%ld) = %s", (long)*size,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -506,7 +498,6 @@ eb_narrow_font_size(EB_Book *book, size_t *size)
failed:
*size = 0;
LOG(("out: eb_narrow_font_size() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -564,7 +555,6 @@ eb_narrow_font_start(EB_Book *book, int *start)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_narrow_font_start(book=%d)", (int)book->code));
/*
@ -587,7 +577,6 @@ eb_narrow_font_start(EB_Book *book, int *start)
LOG(("out: eb_narrow_font_start(start=%d) = %s", *start,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -596,7 +585,6 @@ eb_narrow_font_start(EB_Book *book, int *start)
*/
failed:
LOG(("out: eb_narrow_font_start() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -610,7 +598,6 @@ eb_narrow_font_end(EB_Book *book, int *end)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_narrow_font_end(book=%d)", (int)book->code));
/*
@ -633,7 +620,6 @@ eb_narrow_font_end(EB_Book *book, int *end)
LOG(("out: eb_narrow_font_end(end=%d) = %s", *end,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -642,7 +628,6 @@ eb_narrow_font_end(EB_Book *book, int *end)
*/
failed:
LOG(("out: eb_narrow_font_end() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -657,7 +642,6 @@ eb_narrow_font_character_bitmap(EB_Book *book, int character_number,
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_narrow_font_character_bitmap(book=%d, character_number=%d)",
(int)book->code, character_number));
@ -689,7 +673,6 @@ eb_narrow_font_character_bitmap(EB_Book *book, int character_number,
LOG(("out: eb_narrow_font_character_bitmap() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -700,7 +683,6 @@ eb_narrow_font_character_bitmap(EB_Book *book, int character_number,
*bitmap = '\0';
LOG(("out: eb_narrow_font_character_bitmap() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -895,7 +877,6 @@ eb_forward_narrow_font_character(EB_Book *book, int n, int *character_number)
if (n < 0)
return eb_backward_narrow_font_character(book, -n, character_number);
eb_lock(&book->lock);
LOG(("in: eb_forward_narrow_font_character(book=%d, n=%d, \
character_number=%d)",
(int)book->code, n, *character_number));
@ -973,7 +954,6 @@ character_number=%d)",
LOG(("out: eb_forward_narrow_font_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -984,7 +964,6 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_forward_narrow_font_character() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -1003,7 +982,6 @@ eb_backward_narrow_font_character(EB_Book *book, int n, int *character_number)
if (n < 0)
return eb_forward_narrow_font_character(book, -n, character_number);
eb_lock(&book->lock);
LOG(("in: eb_backward_narrow_font_character(book=%d, n=%d, \
character_number=%d)",
(int)book->code, n, *character_number));
@ -1081,7 +1059,6 @@ character_number=%d)",
LOG(("out: eb_backward_narrow_font_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -1092,6 +1069,5 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_backward_narrow_font_character() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -181,8 +181,6 @@ eb_seek_text(EB_Book *book, const EB_Position *position)
{
EB_Error_Code error_code;
pthread_mutex_lock(&cache_mutex);
eb_lock(&book->lock);
LOG(("in: eb_seek_text(book=%d, position={%d,%d})", (int)book->code,
position->page, position->offset));
@ -215,8 +213,6 @@ eb_seek_text(EB_Book *book, const EB_Position *position)
* Unlock cache data and the book.
*/
LOG(("out: eb_seek_text() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
pthread_mutex_unlock(&cache_mutex);
return EB_SUCCESS;
@ -226,8 +222,6 @@ eb_seek_text(EB_Book *book, const EB_Position *position)
failed:
eb_invalidate_text_context(book);
LOG(("out: eb_seek_text() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
pthread_mutex_unlock(&cache_mutex);
return error_code;
}
@ -240,7 +234,6 @@ eb_tell_text(EB_Book *book, EB_Position *position)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_tell_text(book=%d)", (int)book->code));
/*
@ -260,7 +253,6 @@ eb_tell_text(EB_Book *book, EB_Position *position)
LOG(("out: eb_seek_text(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -270,7 +262,6 @@ eb_tell_text(EB_Book *book, EB_Position *position)
failed:
eb_invalidate_text_context(book);
LOG(("out: eb_seek_text() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -286,11 +277,8 @@ eb_read_text(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
const EB_Hook *hook;
EB_Position position;
eb_lock(&book->lock);
if (appendix != NULL)
eb_lock(&appendix->lock);
if (hookset != NULL)
eb_lock(&hookset->lock);
LOG(("in: eb_read_text(book=%d, appendix=%d, text_max_length=%ld)",
(int)book->code, (appendix != NULL) ? (int)appendix->code : 0,
(long)text_max_length));
@ -356,10 +344,7 @@ eb_read_text(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
LOG(("out: eb_read_text(text_length=%ld) = %s", (long)*text_length,
eb_error_string(EB_SUCCESS)));
if (hookset != &eb_default_hookset)
eb_unlock(&hookset->lock);
if (appendix != NULL)
eb_unlock(&appendix->lock);
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -369,10 +354,7 @@ eb_read_text(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
eb_invalidate_text_context(book);
LOG(("out: eb_read_text() = %s", eb_error_string(error_code)));
if (hookset != &eb_default_hookset)
eb_unlock(&hookset->lock);
if (appendix != NULL)
eb_unlock(&appendix->lock);
eb_unlock(&book->lock);
return error_code;
}
@ -387,11 +369,8 @@ eb_read_heading(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
EB_Error_Code error_code;
const EB_Hook *hook;
eb_lock(&book->lock);
if (appendix != NULL)
eb_lock(&appendix->lock);
if (hookset != NULL)
eb_lock(&hookset->lock);
LOG(("in: eb_read_heading(book=%d, appendix=%d, text_max_length=%ld)",
(int)book->code, (appendix != NULL) ? (int)appendix->code : 0,
(long)text_max_length));
@ -444,10 +423,7 @@ eb_read_heading(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
LOG(("out: eb_read_heading(text_length=%ld) = %s", (long)*text_length,
eb_error_string(EB_SUCCESS)));
if (hookset != &eb_default_hookset)
eb_unlock(&hookset->lock);
if (appendix != NULL)
eb_unlock(&appendix->lock);
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -457,10 +433,7 @@ eb_read_heading(EB_Book *book, EB_Appendix *appendix, EB_Hookset *hookset,
eb_invalidate_text_context(book);
LOG(("out: eb_read_heading() = %s", eb_error_string(error_code)));
if (hookset != &eb_default_hookset)
eb_unlock(&hookset->lock);
if (appendix != NULL)
eb_unlock(&appendix->lock);
eb_unlock(&book->lock);
return error_code;
}
@ -474,7 +447,6 @@ eb_read_rawtext(EB_Book *book, size_t text_max_length, char *text,
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_read_rawtext(book=%d, text_max_length=%ld)",
(int)book->code, (long)text_max_length));
@ -522,7 +494,6 @@ eb_read_rawtext(EB_Book *book, size_t text_max_length, char *text,
LOG(("out: eb_read_rawtext(text_length=%ld) = %s", (long)*text_length,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -533,7 +504,6 @@ eb_read_rawtext(EB_Book *book, size_t text_max_length, char *text,
*text_length = -1;
eb_invalidate_text_context(book);
LOG(("out: eb_read_rawtext() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -558,7 +528,6 @@ eb_read_text_internal(EB_Book *book, EB_Appendix *appendix,
unsigned int argv[EB_MAX_ARGV];
int argc;
pthread_mutex_lock(&cache_mutex);
LOG(("in: eb_read_text_internal(book=%d, appendix=%d, \
text_max_length=%ld, forward=%d)",
(int)book->code, (appendix != NULL) ? (int)appendix->code : 0,
@ -1501,7 +1470,6 @@ text_max_length=%ld, forward=%d)",
LOG(("out: eb_read_text_internal(text_length=%ld) = %s",
(text_length == NULL) ? 0L : (long)*text_length,
eb_error_string(EB_SUCCESS)));
pthread_mutex_unlock(&cache_mutex);
return EB_SUCCESS;
@ -1517,7 +1485,6 @@ text_max_length=%ld, forward=%d)",
if (error_code == EB_ERR_FAIL_READ_TEXT)
cache_book_code = EB_BOOK_NONE;
LOG(("out: eb_read_text_internal() = %s", eb_error_string(error_code)));
pthread_mutex_unlock(&cache_mutex);
return error_code;
}
@ -1553,7 +1520,6 @@ eb_is_text_stopped(EB_Book *book)
{
int is_stopped = 0;
eb_lock(book);
LOG(("in: eb_is_text_stopped(book=%d)", (int)book->code));
if (book->subbook_current != NULL) {
@ -1796,7 +1762,6 @@ eb_forward_text(EB_Book *book, EB_Appendix *appendix)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_forward_text(book=%d, appendix=%d)", (int)book->code,
(appendix != NULL) ? (int)appendix->code : 0));
@ -1845,7 +1810,6 @@ eb_forward_text(EB_Book *book, EB_Appendix *appendix)
succeeded:
eb_reset_text_context(book);
LOG(("out: eb_forward_text() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -1855,7 +1819,6 @@ eb_forward_text(EB_Book *book, EB_Appendix *appendix)
if (error_code != EB_ERR_END_OF_CONTENT)
eb_invalidate_text_context(book);
LOG(("out: eb_forward_text() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -1869,7 +1832,6 @@ eb_forward_heading(EB_Book *book)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_forward_heading(book=%d)", (int)book->code));
if (book->subbook_current == NULL) {
@ -1914,7 +1876,6 @@ eb_forward_heading(EB_Book *book)
*/
succeeded:
LOG(("out: eb_forward_heading() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -1924,7 +1885,6 @@ eb_forward_heading(EB_Book *book)
if (error_code != EB_ERR_END_OF_CONTENT)
eb_invalidate_text_context(book);
LOG(("out: eb_forward_heading() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -1946,7 +1906,6 @@ eb_backward_text(EB_Book *book, EB_Appendix *appendix)
ssize_t read_result;
int stop_code0, stop_code1;
eb_lock(&book->lock);
LOG(("in: eb_backward_text(book=%d, appendix=%d)", (int)book->code,
(appendix != NULL) ? (int)appendix->code : 0));
@ -2125,7 +2084,6 @@ eb_backward_text(EB_Book *book, EB_Appendix *appendix)
* Unlock the book and hookset.
*/
LOG(("out: eb_forward_text() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
@ -2134,7 +2092,6 @@ eb_backward_text(EB_Book *book, EB_Appendix *appendix)
failed:
eb_invalidate_text_context(book);
LOG(("out: eb_backward_text() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

View File

@ -275,7 +275,6 @@ eb_presearch_word(EB_Book *book, EB_Search_Context *context)
int index_depth;
char *cache_p;
pthread_mutex_lock(&cache_mutex);
LOG(("in: eb_presearch_word(book=%d)", (int)book->code));
/*
@ -375,7 +374,6 @@ entry_length=%d, entry_arrangement=%d, entry_count=%d)",
succeeded:
LOG(("out: eb_presearch_word() = %s", eb_error_string(EB_SUCCESS)));
pthread_mutex_unlock(&cache_mutex);
return EB_SUCCESS;
/*
@ -383,7 +381,6 @@ entry_length=%d, entry_arrangement=%d, entry_count=%d)",
*/
failed:
LOG(("out: eb_presearch_word() = %s", eb_error_string(error_code)));
pthread_mutex_unlock(&cache_mutex);
return error_code;
}
@ -403,8 +400,6 @@ eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list, int *hit_count)
/*
* Lock cache data and the book.
*/
pthread_mutex_lock(&cache_mutex);
eb_lock(&book->lock);
LOG(("in: eb_hit_list(book=%d, max_hit_count=%d)", (int)book->code,
max_hit_count));
@ -543,8 +538,6 @@ eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list, int *hit_count)
succeeded:
LOG(("out: eb_hit_list(hit_count=%d) = %s",
*hit_count, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
pthread_mutex_unlock(&cache_mutex);
return EB_SUCCESS;
/*
@ -553,8 +546,6 @@ eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list, int *hit_count)
failed:
*hit_count = 0;
LOG(("out: eb_hit_list() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
pthread_mutex_unlock(&cache_mutex);
return error_code;
}

View File

@ -39,7 +39,6 @@
int
eb_have_stop_code(EB_Appendix *appendix)
{
eb_lock(&appendix->lock);
LOG(("in: eb_have_stop_code(appendix=%d)", (int)appendix->code));
/*
@ -52,7 +51,6 @@ eb_have_stop_code(EB_Appendix *appendix)
goto failed;
LOG(("out: eb_have_stop_code() = %d", 1));
eb_unlock(&appendix->lock);
return 1;
@ -61,7 +59,6 @@ eb_have_stop_code(EB_Appendix *appendix)
*/
failed:
LOG(("out: eb_have_stop_code() = %d", 0));
eb_unlock(&appendix->lock);
return 0;
}
@ -74,7 +71,6 @@ eb_stop_code(EB_Appendix *appendix, int *stop_code)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_stop_code(appendix=%d)", (int)appendix->code));
/*
@ -95,7 +91,6 @@ eb_stop_code(EB_Appendix *appendix, int *stop_code)
LOG(("out: eb_stop_code(stop_code=%d,%d) = %s",
stop_code[0], stop_code[1], eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -106,6 +101,5 @@ eb_stop_code(EB_Appendix *appendix, int *stop_code)
stop_code[0] = -1;
stop_code[1] = -1;
LOG(("out: eb_stop_code() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}

View File

@ -219,7 +219,6 @@ eb_load_all_subbooks(EB_Book *book)
EB_Subbook *subbook;
int i;
eb_lock(&book->lock);
LOG(("in: eb_load_all_subbooks(book=%d)", (int)book->code));
/*
@ -242,7 +241,6 @@ eb_load_all_subbooks(EB_Book *book)
eb_unset_subbook(book);
LOG(("out: eb_load_all_subbooks() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -252,7 +250,6 @@ eb_load_all_subbooks(EB_Book *book)
failed:
eb_unset_subbook(book);
LOG(("out: eb_load_all_subbooks() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -540,7 +537,6 @@ eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
EB_Subbook_Code *list_p;
int i;
eb_lock(&book->lock);
LOG(("in: eb_subbook_list(book=%d)", (int)book->code));
/*
@ -557,7 +553,6 @@ eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
LOG(("out: eb_subbook_list(subbook_count=%d) = %s", *subbook_count,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -567,7 +562,6 @@ eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
failed:
*subbook_count = 0;
LOG(("out: eb_subbook_list() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -580,7 +574,6 @@ eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_subbook(book=%d)", (int)book->code));
/*
@ -595,7 +588,6 @@ eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code)
LOG(("out: eb_subbook(subbook_code=%d) = %s", *subbook_code,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -605,7 +597,6 @@ eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code)
failed:
*subbook_code = EB_SUBBOOK_INVALID;
LOG(("out: eb_subbook() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -618,7 +609,6 @@ eb_subbook_title(EB_Book *book, char *title)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_subbook_title(book=%d)", (int)book->code));
/*
@ -633,7 +623,6 @@ eb_subbook_title(EB_Book *book, char *title)
LOG(("out: eb_subbook_title(title=%s) = %s", title,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -643,7 +632,6 @@ eb_subbook_title(EB_Book *book, char *title)
failed:
*title = '\0';
LOG(("out: eb_subbook_title() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -656,7 +644,6 @@ eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code, char *title)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_subbook_title2(book=%d, subbook_code=%d)",
(int)book->code, (int)subbook_code));
@ -680,7 +667,6 @@ eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code, char *title)
LOG(("out: eb_subbook_title2(title=%s) = %s", title,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -690,7 +676,6 @@ eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code, char *title)
failed:
*title = '\0';
LOG(("out: eb_subbook_title2() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -704,7 +689,6 @@ eb_subbook_directory(EB_Book *book, char *directory)
EB_Error_Code error_code;
char *p;
eb_lock(&book->lock);
LOG(("in: eb_subbook_directory(book=%d)", (int)book->code));
/*
@ -727,7 +711,6 @@ eb_subbook_directory(EB_Book *book, char *directory)
LOG(("out: eb_subbook_directory(directory=%s) = %s", directory,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -737,7 +720,6 @@ eb_subbook_directory(EB_Book *book, char *directory)
failed:
*directory = '\0';
LOG(("out: eb_subbook_directory() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -752,7 +734,6 @@ eb_subbook_directory2(EB_Book *book, EB_Subbook_Code subbook_code,
EB_Error_Code error_code;
char *p;
eb_lock(&book->lock);
LOG(("in: eb_subbook_directory2(book=%d, subbook_code=%d)",
(int)book->code, (int)subbook_code));
@ -784,7 +765,6 @@ eb_subbook_directory2(EB_Book *book, EB_Subbook_Code subbook_code,
LOG(("out: eb_subbook_directory2(directory=%s) = %s", directory,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -794,7 +774,6 @@ eb_subbook_directory2(EB_Book *book, EB_Subbook_Code subbook_code,
failed:
*directory = '\0';
LOG(("out: eb_subbook_directory2() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -807,7 +786,6 @@ eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code)
{
EB_Error_Code error_code = EB_SUCCESS;
eb_lock(&book->lock);
LOG(("in: eb_set_subbook(book=%d, subbook_code=%d)",
(int)book->code, (int)subbook_code));
@ -868,7 +846,6 @@ eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code)
succeeded:
book->subbook_current->initialized = 1;
LOG(("out: eb_set_subbook() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return error_code;
@ -884,7 +861,6 @@ eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code)
}
book->subbook_current = NULL;
LOG(("out: eb_set_subbook() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -1119,7 +1095,6 @@ eb_set_subbook_epwing(EB_Book *book, EB_Subbook_Code subbook_code)
void
eb_unset_subbook(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_unset_subbook(book=%d)", (int)book->code));
/*
@ -1136,5 +1111,4 @@ eb_unset_subbook(EB_Book *book)
}
LOG(("out: eb_unset_subbook()"));
eb_unlock(&book->lock);
}

6
text.c
View File

@ -38,7 +38,6 @@
int
eb_have_text(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_text(book=%d)", (int)book->code));
/*
@ -54,7 +53,6 @@ eb_have_text(EB_Book *book)
goto failed;
LOG(("out: eb_have_text() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -63,7 +61,6 @@ eb_have_text(EB_Book *book)
*/
failed:
LOG(("out: eb_have_text() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -77,7 +74,6 @@ eb_text(EB_Book *book, EB_Position *position)
EB_Error_Code error_code;
int page;
eb_lock(&book->lock);
LOG(("in: eb_text(book=%d)", (int)book->code));
/*
@ -105,7 +101,6 @@ eb_text(EB_Book *book, EB_Position *position)
LOG(("out: eb_text(position={%d,%d}) = %s",
position->page, position->offset, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -114,7 +109,6 @@ eb_text(EB_Book *book, EB_Position *position)
*/
failed:
LOG(("out: eb_text() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

8
text.h
View File

@ -29,10 +29,6 @@
#ifndef EB_TEXT_H
#define EB_TEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include "defs.h"
@ -155,8 +151,4 @@ const char *eb_current_candidate(EB_Book *book);
EB_Error_Code eb_forward_text(EB_Book *book, EB_Appendix *appendix);
EB_Error_Code eb_backward_text(EB_Book *book, EB_Appendix *appendix);
#ifdef __cplusplus
}
#endif
#endif /* not EB_TEXT_H */

View File

@ -54,7 +54,6 @@ static EB_Error_Code eb_wide_character_text_latin(EB_Appendix *appendix,
int
eb_have_wide_alt(EB_Appendix *appendix)
{
eb_lock(&appendix->lock);
LOG(("in: eb_have_wide_alt(appendix=%d)", (int)appendix->code));
/*
@ -67,7 +66,6 @@ eb_have_wide_alt(EB_Appendix *appendix)
goto failed;
LOG(("out: eb_have_wide_alt() = %d", 1));
eb_unlock(&appendix->lock);
return 1;
@ -76,7 +74,6 @@ eb_have_wide_alt(EB_Appendix *appendix)
*/
failed:
LOG(("out: eb_have_wide_alt() = %d", 0));
eb_unlock(&appendix->lock);
return 0;
}
@ -90,7 +87,6 @@ eb_wide_alt_start(EB_Appendix *appendix, int *start)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_wide_alt_start(appendix=%d)", (int)appendix->code));
/*
@ -110,7 +106,6 @@ eb_wide_alt_start(EB_Appendix *appendix, int *start)
LOG(("out: eb_wide_alt_start(start=%d) = %s", *start,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -120,7 +115,6 @@ eb_wide_alt_start(EB_Appendix *appendix, int *start)
failed:
*start = -1;
LOG(("out: eb_wide_alt_start() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -134,7 +128,6 @@ eb_wide_alt_end(EB_Appendix *appendix, int *end)
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_wide_alt_end(appendix=%d)", (int)appendix->code));
/*
@ -154,7 +147,6 @@ eb_wide_alt_end(EB_Appendix *appendix, int *end)
LOG(("out: eb_wide_alt_end(end=%d) = %s", *end,
eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -164,7 +156,6 @@ eb_wide_alt_end(EB_Appendix *appendix, int *end)
failed:
*end = -1;
LOG(("out: eb_wide_alt_end() = %s", eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -178,7 +169,6 @@ eb_wide_alt_character_text(EB_Appendix *appendix, int character_number,
{
EB_Error_Code error_code;
eb_lock(&appendix->lock);
LOG(("in: eb_wide_alt_character_text(appendix=%d, character_number=%d)",
(int)appendix->code, character_number));
@ -210,7 +200,6 @@ eb_wide_alt_character_text(EB_Appendix *appendix, int character_number,
LOG(("out: eb_wide_alt_character_text(text=%s) = %s",
eb_quoted_string(text), eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -221,7 +210,6 @@ eb_wide_alt_character_text(EB_Appendix *appendix, int character_number,
*text = '\0';
LOG(("out: eb_wide_alt_character_text() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -423,7 +411,6 @@ eb_forward_wide_alt_character(EB_Appendix *appendix, int n,
character_number);
}
eb_lock(&appendix->lock);
LOG(("in: eb_forward_wide_alt_character(appendix=%d, n=%d, \
character_number=%d)",
(int)appendix->code, n, *character_number));
@ -501,7 +488,6 @@ character_number=%d)",
LOG(("out: eb_forkward_wide_alt_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -512,7 +498,6 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_forward_wide_alt_character() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}
@ -533,7 +518,6 @@ eb_backward_wide_alt_character(EB_Appendix *appendix, int n,
return eb_forward_wide_alt_character(appendix, -n, character_number);
}
eb_lock(&appendix->lock);
LOG(("in: eb_backward_wide_alt_character(appendix=%d, n=%d, \
character_number=%d)",
(int)appendix->code, n, *character_number));
@ -611,7 +595,6 @@ character_number=%d)",
LOG(("out: eb_backward_wide_alt_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&appendix->lock);
return EB_SUCCESS;
@ -622,6 +605,5 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_backward_wide_alt_character() = %s",
eb_error_string(error_code)));
eb_unlock(&appendix->lock);
return error_code;
}

View File

@ -314,7 +314,6 @@ eb_have_wide_font(EB_Book *book)
{
int i;
eb_lock(&book->lock);
LOG(("in: eb_have_wide_font(book=%d)", (int)book->code));
/*
@ -343,7 +342,6 @@ eb_have_wide_font(EB_Book *book)
succeeded:
LOG(("out: eb_have_wide_font() = %d", 1));
eb_unlock(&book->lock);
return 1;
/*
@ -351,7 +349,6 @@ eb_have_wide_font(EB_Book *book)
*/
failed:
LOG(("out: eb_have_wide_font() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -365,7 +362,6 @@ eb_wide_font_width(EB_Book *book, int *width)
EB_Error_Code error_code;
EB_Font_Code font_code;
eb_lock(&book->lock);
LOG(("in: eb_wide_font_width(book=%d)", (int)book->code));
/*
@ -394,7 +390,6 @@ eb_wide_font_width(EB_Book *book, int *width)
LOG(("out: eb_wide_font_width(width=%d) = %s", (int)*width,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -404,7 +399,6 @@ eb_wide_font_width(EB_Book *book, int *width)
failed:
*width = 0;
LOG(("out: eb_wide_font_width() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -464,7 +458,6 @@ eb_wide_font_size(EB_Book *book, size_t *size)
int width;
int height;
eb_lock(&book->lock);
LOG(("in: eb_wide_font_size(book=%d)", (int)book->code));
/*
@ -497,7 +490,6 @@ eb_wide_font_size(EB_Book *book, size_t *size)
LOG(("out: eb_wide_font_size(size=%ld) = %s", (long)*size,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -507,7 +499,6 @@ eb_wide_font_size(EB_Book *book, size_t *size)
failed:
*size = 0;
LOG(("out: eb_wide_font_size() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -565,7 +556,6 @@ eb_wide_font_start(EB_Book *book, int *start)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_wide_font_start(book=%d)", (int)book->code));
/*
@ -588,7 +578,6 @@ eb_wide_font_start(EB_Book *book, int *start)
LOG(("out: eb_wide_font_start(start=%d) = %s", *start,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -597,7 +586,6 @@ eb_wide_font_start(EB_Book *book, int *start)
*/
failed:
LOG(("out: eb_wide_font_start() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -611,7 +599,6 @@ eb_wide_font_end(EB_Book *book, int *end)
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_wide_font_end(book=%d)", (int)book->code));
/*
@ -634,7 +621,6 @@ eb_wide_font_end(EB_Book *book, int *end)
LOG(("out: eb_wide_font_end(end=%d) = %s", *end,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -643,7 +629,6 @@ eb_wide_font_end(EB_Book *book, int *end)
*/
failed:
LOG(("out: eb_wide_font_end() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -658,7 +643,6 @@ eb_wide_font_character_bitmap(EB_Book *book, int character_number,
{
EB_Error_Code error_code;
eb_lock(&book->lock);
LOG(("in: eb_wide_font_character_bitmap(book=%d, character_number=%d)",
(int)book->code, character_number));
@ -690,7 +674,6 @@ eb_wide_font_character_bitmap(EB_Book *book, int character_number,
LOG(("out: eb_wide_font_character_bitmap() = %s",
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -701,7 +684,6 @@ eb_wide_font_character_bitmap(EB_Book *book, int character_number,
*bitmap = '\0';
LOG(("out: eb_wide_font_character_bitmap() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -896,7 +878,6 @@ eb_forward_wide_font_character(EB_Book *book, int n, int *character_number)
if (n < 0)
return eb_backward_wide_font_character(book, -n, character_number);
eb_lock(&book->lock);
LOG(("in: eb_forward_wide_font_character(book=%d, n=%d, \
character_number=%d)",
(int)book->code, n, *character_number));
@ -974,7 +955,6 @@ character_number=%d)",
LOG(("out: eb_forward_wide_font_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -985,7 +965,6 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_forward_wide_font_character() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
@ -1004,7 +983,6 @@ eb_backward_wide_font_character(EB_Book *book, int n, int *character_number)
if (n < 0)
return eb_forward_wide_font_character(book, -n, character_number);
eb_lock(&book->lock);
LOG(("in: eb_backward_wide_font_character(book=%d, n=%d, \
character_number=%d)",
(int)book->code, n, *character_number));
@ -1082,7 +1060,6 @@ character_number=%d)",
LOG(("out: eb_backward_wide_font_character(character_number=%d) = %s",
*character_number, eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -1093,6 +1070,5 @@ character_number=%d)",
*character_number = -1;
LOG(("out: eb_backward_wide_font_character() = %s",
eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

6
word.c
View File

@ -38,7 +38,6 @@
int
eb_have_word_search(EB_Book *book)
{
eb_lock(&book->lock);
LOG(("in: eb_have_word_search(book=%d)", (int)book->code));
/*
@ -53,7 +52,6 @@ eb_have_word_search(EB_Book *book)
goto failed;
LOG(("out: eb_have_word_search() = %d", 1));
eb_unlock(&book->lock);
return 1;
@ -62,7 +60,6 @@ eb_have_word_search(EB_Book *book)
*/
failed:
LOG(("out: eb_have_word_search() = %d", 0));
eb_unlock(&book->lock);
return 0;
}
@ -77,7 +74,6 @@ eb_search_word(EB_Book *book, const char *input_word)
EB_Word_Code word_code;
EB_Search_Context *context;
eb_lock(&book->lock);
LOG(("in: eb_search_word(book=%d, input_word=%s)", (int)book->code,
eb_quoted_string(input_word)));
@ -170,7 +166,6 @@ eb_search_word(EB_Book *book, const char *input_word)
goto failed;
LOG(("out: eb_search_word() = %s", eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
@ -180,6 +175,5 @@ eb_search_word(EB_Book *book, const char *input_word)
failed:
eb_reset_search_contexts(book);
LOG(("out: eb_search_word() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}

19
zio.c
View File

@ -60,8 +60,6 @@
* Mutual exclusion lock of Pthreads.
*/
#ifndef ENABLE_PTHREAD
#define pthread_mutex_lock(m)
#define pthread_mutex_unlock(m)
#endif
/*
@ -168,7 +166,6 @@ static ssize_t zio_read_raw(Zio *zio, void *buffer, size_t length);
int
zio_initialize_library(void)
{
pthread_mutex_lock(&zio_mutex);
LOG(("in: zio_initialize_library()"));
/*
@ -181,7 +178,6 @@ zio_initialize_library(void)
}
LOG(("out: zio_initialize_library() = %d", 0));
pthread_mutex_unlock(&zio_mutex);
return 0;
/*
@ -189,7 +185,6 @@ zio_initialize_library(void)
*/
failed:
LOG(("out: zio_initialize_library() = %d", -1));
pthread_mutex_unlock(&zio_mutex);
return -1;
}
@ -200,7 +195,6 @@ zio_initialize_library(void)
void
zio_finalize_library(void)
{
pthread_mutex_lock(&zio_mutex);
LOG(("in: zio_finalize_library()"));
if (cache_buffer != NULL)
@ -209,7 +203,6 @@ zio_finalize_library(void)
cache_zio_id = ZIO_ID_NONE;
LOG(("out: zio_finalize_library()"));
pthread_mutex_unlock(&zio_mutex);
}
@ -384,9 +377,7 @@ zio_open_plain(Zio *zio, const char *file_name)
/*
* Assign ID.
*/
pthread_mutex_lock(&zio_mutex);
zio->id = zio_counter++;
pthread_mutex_unlock(&zio_mutex);
LOG(("out: zio_open_plain(zio=%d) = %d", (int)zio->id, zio->file));
return zio->file;
@ -464,9 +455,7 @@ zio_open_ebzip(Zio *zio, const char *file_name)
/*
* Assign ID.
*/
pthread_mutex_lock(&zio_mutex);
zio->id = zio_counter++;
pthread_mutex_unlock(&zio_mutex);
LOG(("out: zio_open_ebzip(zio=%d) = %d", (int)zio->id, zio->file));
return zio->file;
@ -623,9 +612,7 @@ zio_open_epwing(Zio *zio, const char *file_name)
/*
* Assign ID.
*/
pthread_mutex_lock(&zio_mutex);
zio->id = zio_counter++;
pthread_mutex_unlock(&zio_mutex);
LOG(("out: zio_open_epwing(zio=%d) = %d", (int)zio->id, zio->file));
return zio->file;
@ -811,9 +798,7 @@ zio_open_epwing6(Zio *zio, const char *file_name)
/*
* Assign ID.
*/
pthread_mutex_lock(&zio_mutex);
zio->id = zio_counter++;
pthread_mutex_unlock(&zio_mutex);
LOG(("out: zio_open_epwing6(zio=%d) = %d", (int)zio->id, zio->file));
return zio->file;
@ -958,7 +943,6 @@ zio_make_epwing_huffman_tree(Zio *zio, int leaf_count)
void
zio_close(Zio *zio)
{
pthread_mutex_lock(&zio_mutex);
LOG(("in: zio_close(zio=%d)", (int)zio->id));
/*
@ -969,7 +953,6 @@ zio_close(Zio *zio)
zio->file = -1;
LOG(("out: zio_close()"));
pthread_mutex_unlock(&zio_mutex);
}
@ -1072,7 +1055,6 @@ zio_read(Zio *zio, char *buffer, size_t length)
{
ssize_t read_length;
pthread_mutex_lock(&zio_mutex);
LOG(("in: zio_read(zio=%d, length=%ld)", (int)zio->id, (long)length));
/*
@ -1100,7 +1082,6 @@ zio_read(Zio *zio, char *buffer, size_t length)
}
LOG(("out: zio_read() = %ld", (long)read_length));
pthread_mutex_unlock(&zio_mutex);
return read_length;

8
zio.h
View File

@ -29,10 +29,6 @@
#ifndef ZIO_H
#define ZIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <time.h>
@ -225,8 +221,4 @@ Zio_Code zio_mode(Zio *zio);
off_t zio_lseek(Zio *zio, off_t offset, int whence);
ssize_t zio_read(Zio *zio, char *buffer, size_t length);
#ifdef __cplusplus
}
#endif
#endif /* not ZIO_H */