also replace ecalloc with emalloc+memset, so that the latter can be inlined.
RETURN_FALSE;
}
- info = ecalloc(sizeof(dba_info), 1);
+ info = emalloc(sizeof(dba_info));
+ memset(info, 0, sizeof(dba_info));
info->path = estrdup(Z_STRVAL_PP(args[0]));
info->mode = modenr;
info->argc = ac - 3;
info->argv = args + 3;
- /* info->hnd is NULL here */
if (hptr->open(info, &error TSRMLS_CC) != SUCCESS) {
dba_close(info TSRMLS_CC);
return FAILURE;
}
- cdb = ecalloc(sizeof(dba_cdb), 1);
- if (!cdb) {
- pinfo->dbf = cdb;
-#if DBA_CDB_BUILTIN
- php_stream_close(file);
-#else
- close(file);
-#endif
- *error = "Out of memory";
- return FAILURE;
- }
+ cdb = emalloc(sizeof(dba_cdb));
+ memset(cdb, 0, sizeof(dba_cdb));
#if DBA_CDB_BUILTIN
if (make) {
return FAILURE;
}
- info->dbf = ecalloc(sizeof(dba_db2_data), 1);
- if (!info->dbf) {
- *error = "Out of memory";
- return FAILURE;
- }
+ info->dbf = emalloc(sizeof(dba_db2_data));
+ memset(info->dbf, 0, sizeof(dba_db2_data));
((dba_db2_data *) info->dbf)->dbp = dbp;
return SUCCESS;
}
dba_db3_data *data;
data = emalloc(sizeof(*data));
- if (!data) {
- *error = "Out of memory";
- return FAILURE;
- }
data->dbp = dbp;
data->cursor = NULL;
info->dbf = data;
return FAILURE;
}
- info->dbf = ecalloc(sizeof(dba_dbm_data), 1);
- if (!info->dbf) {
- *error = "Out of memory";
- return FAILURE;
- }
+ info->dbf = emalloc(sizeof(dba_dbm_data));
+ memset(info->dbf, 0, sizeof(dba_dbm_data));
return SUCCESS;
}
int retries = 0;
#endif
- info->dbf = ecalloc(sizeof(flatfile), 1);
- if (!info->dbf) {
- *error = "Out of memory";
- return FAILURE;
- }
+ info->dbf = emalloc(sizeof(flatfile));
+ memset(info->dbf, 0, sizeof(flatfile));
switch(info->mode) {
case DBA_READER:
dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
if(dbf) {
- info->dbf = ecalloc(sizeof(dba_gdbm_data), 1);
- if (!info->dbf) {
- *error = "Out of memory";
- gdbm_close(dbf);
- return FAILURE;
- }
+ info->dbf = emalloc(sizeof(dba_gdbm_data));
+ memset(info->dbf, 0, sizeof(dba_gdbm_data));
((dba_gdbm_data *) info->dbf)->dbf = dbf;
return SUCCESS;
}
dbf = dbm_open(info->path, gmode, filemode);
- if(dbf) {
- pinfo->dbf = dbf;
- return SUCCESS;
- }
- *error = "Out of memory";
- return FAILURE;
+ pinfo->dbf = dbf;
+ return SUCCESS;
}
DBA_CLOSE_FUNC(ndbm)