/[man-db]/man-db/libdb/db_ver.c
ViewVC logotype

Diff of /man-db/libdb/db_ver.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by cjwatson, Mon Mar 10 17:25:44 2003 UTC revision 1.7 by cjwatson, Thu May 1 15:54:03 2003 UTC
# Line 49  static int dbver (MYDBM_FILE dbf) Line 49  static int dbver (MYDBM_FILE dbf)
49  {  {
50          datum key;          datum key;
51    
52          key.dptr = VER_KEY;          key.dptr = xstrdup (VER_KEY);
53          key.dsize = sizeof VER_KEY;          key.dsize = sizeof VER_KEY;
54    
55          content = MYDBM_FETCH (dbf, key);          content = MYDBM_FETCH (dbf, key);
56    
57            free (key.dptr);
58    
59          if (content.dptr == NULL)          if (content.dptr == NULL)
60                  return -1;                  return -1;
61          else if (!STREQ (content.dptr, VER_ID))          else if (!STREQ (content.dptr, VER_ID))
62                  return 1;                  return 1;
63          else          else
64                  return 0;                  return 0;
   
65  }  }
66    
67  void dbver_wr (MYDBM_FILE dbf)  void dbver_wr (MYDBM_FILE dbf)
68  {  {
69          datum key, content;          datum key, content;
70    
71          key.dptr = VER_KEY;          key.dptr = xstrdup (VER_KEY);
72          key.dsize = sizeof VER_KEY;          key.dsize = sizeof VER_KEY;
73          content.dptr = VER_ID;          content.dptr = xstrdup (VER_ID);
74          content.dsize = sizeof VER_ID;          content.dsize = sizeof VER_ID;
75    
76          if (MYDBM_INSERT (dbf, key, content) != 0)          if (MYDBM_INSERT (dbf, key, content) != 0)
77                  error (FATAL, 0,                  error (FATAL, 0,
78                         _("fatal: unable to insert version identifier into %s"),                         _("fatal: unable to insert version identifier into %s"),
79                         database);                         database);
80    
81            free (key.dptr);
82            free (content.dptr);
83  }  }
84    
85  int dbver_rd (MYDBM_FILE dbf)  int dbver_rd (MYDBM_FILE dbf)

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26