~ubuntu-branches/ubuntu/gutsy/skksearch/gutsy

« back to all changes in this revision

Viewing changes to debian/patches/db4.3.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Noritada Kobayashi
  • Date: 2007-04-23 23:31:41 UTC
  • Revision ID: james.westby@ubuntu.com-20070423233141-c4g4011ogbezfe0v
Tags: 0.0-14
* Switch the patch management system from dpatch to quilt.
* debian/patches/clean-build-errors-and-warnings.diff: A new patch to clean
  build errors and warnings from gcc (currently gcc 4.1.1).
* debian/skksearch.install: A new file to clean up the installation of
  debhelper-independently installed files.
* debian/skksearch.conf: Add an entry for SKK-JISYO.JIS2004, a new
  dictionary provided by the skkdic-extra package since its version
  20070411-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## db4.3.dpatch by Matej Vela <vela@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: Port to Berkeley DB 4.3.
6
 
 
7
 
@DPATCH@
8
 
diff -urNad skksearch-0.0~/dic_db.c skksearch-0.0/dic_db.c
9
 
--- skksearch-0.0~/dic_db.c     2005-11-12 19:49:38.000000000 +0100
10
 
+++ skksearch-0.0/dic_db.c      2005-11-12 19:55:03.000000000 +0100
11
 
@@ -23,19 +23,21 @@
12
 
 
13
 
 /* BerkeleyDB environment */
14
 
 int env_initialized = 0;
15
 
-DB_ENV env;
16
 
-void errcall(const char *, char *);
17
 
+DB_ENV *env;
18
 
+void errcall(const DB_ENV *, const char *, const char *);
19
 
 
20
 
 
21
 
 struct dic *dic_db_open(struct dic *d, char *path) {
22
 
+  int ret;
23
 
   struct dic_db_internal *internal;
24
 
 
25
 
   if (!env_initialized) {
26
 
-    env.db_errcall = errcall;
27
 
-    if ((errno = db_appinit(NULL, NULL, &env, DB_USE_ENVIRON)) != 0) {
28
 
-      err(LOG_ERR, "dic_db_open: db_appinit failed\n");
29
 
+    if ((ret = db_env_create(&env, 0)) != 0
30
 
+       || (ret = env->open(env, NULL, 0, DB_USE_ENVIRON)) != 0) {
31
 
+      err(LOG_ERR, "dic_db_open: %s\n", db_strerror(ret));
32
 
       exit(1);
33
 
     }
34
 
+    env->set_errcall(env, errcall);
35
 
     env_initialized = 1;
36
 
   }
37
 
 
38
 
@@ -45,10 +47,10 @@
39
 
   }
40
 
   memset(internal, 0, sizeof(struct dic_db_internal));
41
 
 
42
 
-  if ((errno =
43
 
-       db_open(path, DB_UNKNOWN, DB_RDONLY, 0, &env, NULL, &(internal->db)))
44
 
-      != 0) {
45
 
-    err(LOG_ERR, "dic_db_open(%s): %s\n", path, strerror(errno));
46
 
+  if ((ret = db_create(&(internal->db), env, 0)) != 0
47
 
+      || (ret = internal->db->open(internal->db, NULL, path, NULL,
48
 
+                                  DB_UNKNOWN, DB_RDONLY, 0)) != 0) {
49
 
+    err(LOG_ERR, "dic_db_open(%s): %s\n", path, db_strerror(ret));
50
 
     exit(1);
51
 
   }
52
 
   d->internal = (void *)internal;
53
 
@@ -58,6 +60,7 @@
54
 
   }
55
 
 
56
 
 char *dic_db_search(struct dic *d, char *keystr, int keylen) {
57
 
+  int ret;
58
 
   struct dic_db_internal *internal = (struct dic_db_internal *)(d->internal);
59
 
   DB *db = internal->db;
60
 
   DBT key;
61
 
@@ -71,23 +74,24 @@
62
 
   data.ulen = DIC_BUFSIZE - 1; /* -1 for '\0' */
63
 
   data.flags = DB_DBT_USERMEM;
64
 
 
65
 
-  if ((errno = db->get(db, NULL, &key, &data, 0)) == DB_NOTFOUND) {
66
 
+  if ((ret = db->get(db, NULL, &key, &data, 0)) == DB_NOTFOUND) {
67
 
     return NULL;
68
 
-  } else if (errno == 0) {     /* found */
69
 
+  } else if (ret == 0) {       /* found */
70
 
     *((char *)(data.data) + data.size) = '\0';
71
 
     return (char *)(data.data);
72
 
   } else {
73
 
     err(LOG_WARNING, "dic_db_search: %s (may be too long entry)\n",
74
 
-       strerror(errno));
75
 
+       db_strerror(ret));
76
 
     return NULL;
77
 
   }
78
 
 }
79
 
 
80
 
 
81
 
 int dic_db_close(struct dic *d) {
82
 
+  int ret;
83
 
   DB *db = ((struct dic_db_internal *)(d->internal))->db;
84
 
-  if ((errno = db->close(db, 0)) != 0) {
85
 
-    err(LOG_ERR, "dic_db_close: %s\n", strerror(errno));
86
 
+  if ((ret = db->close(db, 0)) != 0) {
87
 
+    err(LOG_ERR, "dic_db_close: %s\n", db_strerror(ret));
88
 
     exit(1);
89
 
   }
90
 
   free(d->internal);
91
 
@@ -96,6 +100,6 @@
92
 
 }
93
 
 
94
 
 
95
 
-void errcall(const char *foo, char *message) {
96
 
+void errcall(const DB_ENV *dbenv, const char *foo, const char *message) {
97
 
   err(LOG_ERR, "dic_db: %s\n", message);
98
 
 }