projects
/
selector.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5bb386a
)
Removed the typedef for hash_table_t.
author
Francois Fleuret
<francois@fleuret.org>
Sun, 17 Jan 2010 17:01:44 +0000
(18:01 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Sun, 17 Jan 2010 17:01:44 +0000
(18:01 +0100)
selector.c
patch
|
blob
|
history
diff --git
a/selector.c
b/selector.c
index
d7e0820
..
f6c7b12
100644
(file)
--- a/
selector.c
+++ b/
selector.c
@@
-136,16
+136,16
@@
void error_feedback() {
table. When a string is added, if it was already in the table, the
new index replaces the previous one. */
table. When a string is added, if it was already in the table, the
new index replaces the previous one. */
-
typedef struc
t {
+
struct hash_table_
t {
int size;
int *entries;
int size;
int *entries;
-}
hash_table_t
;
+};
-hash_table_t *new_hash_table(int size) {
+
struct
hash_table_t *new_hash_table(int size) {
int k;
int k;
- hash_table_t *hash_table;
+
struct
hash_table_t *hash_table;
- hash_table = (
hash_table_t *) malloc(sizeof(
hash_table_t));
+ hash_table = (
struct hash_table_t *) malloc(sizeof(struct
hash_table_t));
hash_table->size = size;
hash_table->entries = (int *) malloc(hash_table->size * sizeof(int));
hash_table->size = size;
hash_table->entries = (int *) malloc(hash_table->size * sizeof(int));
@@
-157,7
+157,7
@@
hash_table_t *new_hash_table(int size) {
return hash_table;
}
return hash_table;
}
-void free_hash_table(hash_table_t *hash_table) {
+void free_hash_table(
struct
hash_table_t *hash_table) {
free(hash_table->entries);
free(hash_table);
}
free(hash_table->entries);
free(hash_table);
}
@@
-166,7
+166,7
@@
void free_hash_table(hash_table_t *hash_table) {
string was not already in the table, returns -1. Otherwise, returns
the previous index it had. */
string was not already in the table, returns -1. Otherwise, returns
the previous index it had. */
-int add_and_get_previous_index(hash_table_t *hash_table,
+int add_and_get_previous_index(
struct
hash_table_t *hash_table,
const char *new_string, int new_index,
char **strings) {
const char *new_string, int new_index,
char **strings) {
@@
-617,7
+617,7
@@
void update_screen(int *current_focus_line, int *displayed_focus_line,
/*********************************************************************/
/*********************************************************************/
-void store_line(hash_table_t *hash_table,
+void store_line(
struct
hash_table_t *hash_table,
const char *new_line,
int *nb_lines, char **lines) {
int dup;
const char *new_line,
int *nb_lines, char **lines) {
int dup;
@@
-660,7
+660,7
@@
void store_line(hash_table_t *hash_table,
(*nb_lines)++;
}
(*nb_lines)++;
}
-void read_file(hash_table_t *hash_table,
+void read_file(
struct
hash_table_t *hash_table,
const char *input_filename,
int nb_lines_max, int *nb_lines, char **lines) {
const char *input_filename,
int nb_lines_max, int *nb_lines, char **lines) {
@@
-743,7
+743,7
@@
int main(int argc, char **argv) {
char **lines, **labels;
int nb_lines;
char **lines, **labels;
int nb_lines;
- hash_table_t *hash_table;
+
struct
hash_table_t *hash_table;
if(!ttyname(STDIN_FILENO)) {
fprintf(stderr, "Selector: The standard input is not a tty.\n");
if(!ttyname(STDIN_FILENO)) {
fprintf(stderr, "Selector: The standard input is not a tty.\n");