Ignore:
Timestamp:
Jan 13, 2017, 3:21:12 PM (8 years ago)
Author:
Silvan Scherrer
Message:

ncurses: import vendor version 5.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified ncurses/vendor/current/ncurses/tinfo/hashed_db.c

    r85 r1910  
    11/****************************************************************************
    2  * Copyright (c) 2006 Free Software Foundation, Inc.                        *
     2 * Copyright (c) 2006,2008 Free Software Foundation, Inc.                   *
    33 *                                                                          *
    44 * Permission is hereby granted, free of charge, to any person obtaining a  *
     
    2828
    2929/****************************************************************************
    30  *  Author: Thomas E. Dickey                        2006                    *
     30 *  Author: Thomas E. Dickey                        2006-on                 *
    3131 ****************************************************************************/
    3232
     
    3737#if USE_HASHED_DB
    3838
    39 MODULE_ID("$Id: hashed_db.c,v 1.13 2006/08/19 19:48:38 tom Exp $")
     39MODULE_ID("$Id: hashed_db.c,v 1.14 2008/12/13 20:59:02 tom Exp $")
    4040
    4141#if HASHED_DB_API >= 2
     
    5050{
    5151    DB *result = 0;
     52    int code;
    5253
    5354#if HASHED_DB_API >= 4
    5455    db_create(&result, NULL, 0);
    55     result->open(result,
    56                  NULL,
    57                  path,
    58                  NULL,
    59                  DB_HASH,
    60                  modify ? DB_CREATE : DB_RDONLY,
    61                  0644);
     56    if ((code = result->open(result,
     57                             NULL,
     58                             path,
     59                             NULL,
     60                             DB_HASH,
     61                             modify ? DB_CREATE : DB_RDONLY,
     62                             0644)) != 0) {
     63        result = 0;
     64    }
    6265#elif HASHED_DB_API >= 3
    6366    db_create(&result, NULL, 0);
    64     result->open(result,
    65                  path,
    66                  NULL,
    67                  DB_HASH,
    68                  modify ? DB_CREATE : DB_RDONLY,
    69                  0644);
     67    if ((code = result->open(result,
     68                             path,
     69                             NULL,
     70                             DB_HASH,
     71                             modify ? DB_CREATE : DB_RDONLY,
     72                             0644)) != 0) {
     73        result = 0;
     74    }
    7075#elif HASHED_DB_API >= 2
    71     int code;
    72 
    7376    if ((code = db_open(path,
    7477                        DB_HASH,
     
    7881                        (DB_INFO *) 0,
    7982                        &result)) != 0) {
    80         T(("cannot open %s: %s", path, strerror(code)));
    8183        result = 0;
    82     } else {
    83         T(("opened %s", path));
    84     }
    85 #else
    86     result = dbopen(path,
    87                     modify ? (O_CREAT | O_RDWR) : O_RDONLY,
    88                     0644,
    89                     DB_HASH,
    90                     NULL);
     84    }
     85#else
     86    if ((result = dbopen(path,
     87                         modify ? (O_CREAT | O_RDWR) : O_RDONLY,
     88                         0644,
     89                         DB_HASH,
     90                         NULL)) == 0) {
     91        code = errno;
     92    }
     93#endif
    9194    if (result != 0) {
    9295        T(("opened %s", path));
    93     }
    94 #endif
     96    } else {
     97        T(("cannot open %s: %s", path, strerror(code)));
     98    }
    9599    return result;
    96100}
Note: See TracChangeset for help on using the changeset viewer.