| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-std=gnu17" } */ |
| 3 |
|
| 4 |
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); |
| 5 |
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); |
| 6 |
typedef u_int32_t db_pgno_t; |
| 7 |
typedef struct __db DB; |
| 8 |
typedef struct __db_env DB_ENV; |
| 9 |
typedef struct __db_mpoolfile DB_MPOOLFILE; |
| 10 |
typedef struct __dbc DBC; |
| 11 |
struct __db { |
| 12 |
DB_MPOOLFILE *mpf; |
| 13 |
db_pgno_t meta_pgno; |
| 14 |
struct __cq_aq { |
| 15 |
} s_links; |
| 16 |
}; |
| 17 |
struct __db_env { |
| 18 |
struct { |
| 19 |
} xa_txn; |
| 20 |
u_int32_t flags; |
| 21 |
}; |
| 22 |
typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action; |
| 23 |
typedef struct __dbpginfo { |
| 24 |
u_int8_t type; |
| 25 |
} PAGE; |
| 26 |
int __db_cursor (); |
| 27 |
int __memp_fget (); |
| 28 |
int __db_free (); |
| 29 |
int __db_c_close (); |
| 30 |
int __db_master_update(mdbp, sdbp, txn, subdb, type, action, newname, flags) |
| 31 |
int txn, subdb, type, action, newname, flags; |
| 32 |
DB *mdbp, *sdbp; |
| 33 |
{ |
| 34 |
DB_ENV *dbenv; |
| 35 |
DBC *dbc, *ndbc; |
| 36 |
PAGE *p, *r; |
| 37 |
int modify, ret, t_ret; |
| 38 |
if ((ret = __db_cursor(mdbp, txn, &dbc, |
| 39 |
(((dbenv)->flags & (0x0000002)) |
| 40 |
&& modify) ? 35 : 0)) != 0) |
| 41 |
goto err; |
| 42 |
switch (action) { |
| 43 |
case MU_REMOVE: |
| 44 |
if ((ret = __memp_fget(mdbp->mpf, &sdbp->meta_pgno, 0, &p)) != 0) |
| 45 |
goto err; |
| 46 |
if ((((PAGE *)p)->type) == 9) { |
| 47 |
if ((ret = __db_free(dbc, r)) != 0) { } |
| 48 |
} |
| 49 |
if ((ret = __db_free(dbc, p)) != 0) { |
| 50 |
p = ((void *)0); |
| 51 |
goto err; |
| 52 |
} |
| 53 |
p = ((void *)0); |
| 54 |
} |
| 55 |
err: |
| 56 |
if (ndbc != ((void *)0) && (t_ret = __db_c_close(ndbc)) != 0 && ret == 0) |
| 57 |
ret = t_ret; |
| 58 |
return (ret); |
| 59 |
} |
| 60 |
|