blob: 01d9bdb7ffa80b78319e5ee49fb6d7aae95016b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "converter.h"
#include "utfconverter.h"
#include "tableconverter.h"
typedef struct converter* (*converterfunc)(const char *charset);
struct converter*
converter_open(const char *charset)
{
static converterfunc funcs[] = {
tabconverter_open,
utfconverter_open,
NULL
};
size_t i;
struct converter *conv;
for (i = 0; funcs[i]; i++) {
conv = funcs[i](charset);
if (conv)
return conv;
}
return NULL;
}
void
converter_close(struct converter *conv)
{
if (!conv)
return;
conv->close(conv);
}
void converter_reset(struct converter *conv)
{
if (conv->reset)
conv->reset(conv);
}
|