• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RET_ERR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RET_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ RET_ERR函数的具体用法?C++ RET_ERR怎么用?C++ RET_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RET_ERR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _alpm_log

alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
		alpm_siglevel_t level)
{
	alpm_db_t *db;

	_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);

#ifndef HAVE_LIBGPGME
	if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
		RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
	}
#endif

	db = _alpm_db_new(treename, 0);
	if(db == NULL) {
		RET_ERR(handle, ALPM_ERR_DB_CREATE, NULL);
	}
	db->ops = &sync_db_ops;
	db->handle = handle;
	db->siglevel = level;

	sync_db_validate(db);

	handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
	return db;
}
开发者ID:vadmium,项目名称:pacman-arch,代码行数:26,代码来源:be_sync.c


示例2: strlen

static FILE *create_tempfile(struct dload_payload *payload, const char *localpath)
{
	int fd;
	FILE *fp;
	char *randpath;
	size_t len;

	/* create a random filename, which is opened with O_EXCL */
	len = strlen(localpath) + 14 + 1;
	MALLOC(randpath, len, RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
	snprintf(randpath, len, "%salpmtmp.XXXXXX", localpath);
	if((fd = mkstemp(randpath)) == -1 ||
			fchmod(fd, ~(_getumask()) & 0666) ||
			!(fp = fdopen(fd, payload->tempfile_openmode))) {
		unlink(randpath);
		close(fd);
		_alpm_log(payload->handle, ALPM_LOG_ERROR,
				_("failed to create temporary file for download\n"));
		free(randpath);
		return NULL;
	}
	/* fp now points to our alpmtmp.XXXXXX */
	free(payload->tempfile_name);
	payload->tempfile_name = randpath;
	free(payload->remote_name);
	STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
			RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));

	return fp;
}
开发者ID:cicero-arpini,项目名称:pacman,代码行数:30,代码来源:dload.c


示例3: _alpm_trans_addtarget

/** Add a target to the transaction.
 * @param trans the current transaction
 * @param target the name of the target to add
 * @return 0 on success, -1 on error (pm_errno is set accordingly)
 */
int _alpm_trans_addtarget(pmtrans_t *trans, char *target)
{
	ALPM_LOG_FUNC;

	/* Sanity checks */
	ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
	ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));

	switch(trans->type) {
		case PM_TRANS_TYPE_UPGRADE:
			if(_alpm_add_loadtarget(trans, handle->db_local, target) == -1) {
				/* pm_errno is set by _alpm_add_loadtarget() */
				return(-1);
			}
		break;
		case PM_TRANS_TYPE_REMOVE:
		case PM_TRANS_TYPE_REMOVEUPGRADE:
			if(_alpm_remove_loadtarget(trans, handle->db_local, target) == -1) {
				/* pm_errno is set by _alpm_remove_loadtarget() */
				return(-1);
			}
		break;
		case PM_TRANS_TYPE_SYNC:
			if(_alpm_sync_addtarget(trans, handle->db_local, handle->dbs_sync, target) == -1) {
				/* pm_errno is set by _alpm_sync_loadtarget() */
				return(-1);
			}
		break;
	}

	return(0);
}
开发者ID:LucaLanziani,项目名称:alpm_ruby,代码行数:37,代码来源:trans.c


示例4: alpm_trans_release

/** Release a transaction. */
int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
{
    alpm_trans_t *trans;

    /* Sanity checks */
    CHECK_HANDLE(handle, return -1);

    trans = handle->trans;
    ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
    ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));

    int nolock_flag = trans->flags & ALPM_TRANS_FLAG_NOLOCK;

    _alpm_trans_free(trans);
    handle->trans = NULL;

    /* unlock db */
    if(!nolock_flag) {
        if(_alpm_handle_unlock(handle)) {
            _alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
                      alpm_option_get_lockfile(handle));
            alpm_logaction(handle, "warning: could not remove lock file %s\n",
                           alpm_option_get_lockfile(handle));
        }
    }

    return 0;
}
开发者ID:matthewbauer,项目名称:unipkg-pacman,代码行数:29,代码来源:trans.c


示例5: alpm_trans_init

/** Initialize the transaction. */
int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags,
                              alpm_trans_cb_event event, alpm_trans_cb_conv conv,
                              alpm_trans_cb_progress progress)
{
    alpm_trans_t *trans;

    /* Sanity checks */
    CHECK_HANDLE(handle, return -1);
    ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));

    /* lock db */
    if(!(flags & ALPM_TRANS_FLAG_NOLOCK)) {
        if(_alpm_handle_lock(handle)) {
            RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
        }
    }

    CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
    trans->flags = flags;
    trans->cb_event = event;
    trans->cb_conv = conv;
    trans->cb_progress = progress;
    trans->state = STATE_INITIALIZED;

    handle->trans = trans;

    return 0;
}
开发者ID:matthewbauer,项目名称:unipkg-pacman,代码行数:29,代码来源:trans.c


示例6: alpm_trans_release

/** Release a transaction.
 * @return 0 on success, -1 on error (pm_errno is set accordingly)
 */
int SYMEXPORT alpm_trans_release()
{
	pmtrans_t *trans;

	ALPM_LOG_FUNC;

	/* Sanity checks */
	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));

	trans = handle->trans;
	ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
	ASSERT(trans->state != STATE_IDLE, RET_ERR(PM_ERR_TRANS_NULL, -1));

	_alpm_trans_free(trans);
	handle->trans = NULL;

	/* unlock db */
	if(handle->lckfd != -1) {
		while(close(handle->lckfd) == -1 && errno == EINTR);
		handle->lckfd = -1;
	}
	if(_alpm_lckrm()) {
		_alpm_log(PM_LOG_WARNING, _("could not remove lock file %s\n"),
				alpm_option_get_lockfile());
		alpm_logaction("warning: could not remove lock file %s\n",
				alpm_option_get_lockfile());
	}

	return(0);
}
开发者ID:LucaLanziani,项目名称:alpm_ruby,代码行数:33,代码来源:trans.c


示例7: alpm_remove_pkg

/**
 * @brief Add a package removal action to the transaction.
 *
 * @param handle the context handle
 * @param pkg the package to uninstall
 *
 * @return 0 on success, -1 on error
 */
int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
{
	const char *pkgname;
	alpm_trans_t *trans;
	alpm_pkg_t *copy;

	/* Sanity checks */
	CHECK_HANDLE(handle, return -1);
	ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
	ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
	trans = handle->trans;
	ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
	ASSERT(trans->state == STATE_INITIALIZED,
			RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));

	pkgname = pkg->name;

	if(alpm_pkg_find(trans->remove, pkgname)) {
		RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
	}

	_alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s to the transaction remove list\n",
			pkgname);
	if(_alpm_pkg_dup(pkg, &copy) == -1) {
		return -1;
	}
	trans->remove = alpm_list_add(trans->remove, copy);
	return 0;
}
开发者ID:JohnFrazier,项目名称:pacman,代码行数:37,代码来源:remove.c


示例8: examine_inside_scaling_none

int examine_inside_scaling_none(void)
{
    int i;
    double inside;

    inside_failure = 0.0;

    for (i = 0; i < num_roots; i++) {
        inside = expl_graph[roots[i]->id]->inside;
        if (i == failure_root_index) {
            inside_failure = inside;
            if (!(1.0 - inside_failure > 0.0)) {
                emit_error("Probability of failure being unity");
                RET_ERR(err_invalid_numeric_value);
            }
        }
        else {
            if (!(inside > 0.0)) {
                emit_error("Probability of an observed goal being non-positive (log_scale: off)");
                RET_ERR(err_invalid_numeric_value);
            }
        }
    }

    return BP_TRUE;
}
开发者ID:v-for-vincent,项目名称:consolidated_thesis,代码行数:26,代码来源:em_aux_ml.c


示例9: alpm_db_unregister

/** Unregister a package database. */
int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
{
	int found = 0;
	alpm_handle_t *handle;

	/* Sanity checks */
	ASSERT(db != NULL, return -1);
	/* Do not unregister a database if a transaction is on-going */
	handle = db->handle;
	handle->pm_errno = 0;
	ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));

	if(db == handle->db_local) {
		handle->db_local = NULL;
		found = 1;
	} else {
		/* Warning : this function shouldn't be used to unregister all sync
		 * databases by walking through the list returned by
		 * alpm_get_syncdbs, because the db is removed from that list here.
		 */
		void *data;
		handle->dbs_sync = alpm_list_remove(handle->dbs_sync,
				db, _alpm_db_cmp, &data);
		if(data) {
			found = 1;
		}
	}

	if(!found) {
		RET_ERR(handle, ALPM_ERR_DB_NOT_FOUND, -1);
	}

	db->ops->unregister(db);
	return 0;
}
开发者ID:DavidEGrayson,项目名称:MSYS2-pacman,代码行数:36,代码来源:db.c


示例10: pc_export_sw_info_1

/*
 * Export probabilities of switches from Prolog to C.  Switches is
 * a list of switches, each of which takes the form:
 *
 *   sw(Id,InstanceIds,Probs,SmoothCs,Fixed,FixedH),
 *
 * where
 *    Id:          identifier of the switch
 *    InstanceIds: list of ids of the instances of the switch
 *    Probs:       current probabilities assigned to the instance switches
 *    SmoothCs:    current pseudo counts assigned to the instance switches
 *    Fixed:       probabilities fixed?
 *    FixedH:      pseudo counts fixed?
 *
 * The structures for switch instances have been allocated. This
 * function only fills out the initial probabilities.
 */
int pc_export_sw_info_1(void)
{
    int sw_id,instance_id,fixed,fixed_h;
    double prob,smooth;
    TERM p_switches, p_switch;
    TERM p_instance_list,p_prob_list,p_smooth_list;
    TERM p_prob,p_smooth;

    p_switches = bpx_get_call_arg(1,1);

    while (bpx_is_list(p_switches)) {
        /* p_switch: sw(Id,InstList,ProbList,SmoothCList,FixedP,FixedH) */
        p_switch = bpx_get_car(p_switches);

        sw_id           = bpx_get_integer(bpx_get_arg(1,p_switch));
        p_instance_list = bpx_get_arg(2,p_switch);
        p_prob_list     = bpx_get_arg(3,p_switch);
        p_smooth_list   = bpx_get_arg(4,p_switch);
        fixed           = bpx_get_integer(bpx_get_arg(5,p_switch));
        fixed_h         = bpx_get_integer(bpx_get_arg(6,p_switch));

        while (bpx_is_list(p_instance_list)) {
            instance_id = bpx_get_integer(bpx_get_car(p_instance_list));
            p_prob      = bpx_get_car(p_prob_list);
            p_smooth    = bpx_get_car(p_smooth_list);

            if (bpx_is_integer(p_prob)) {
                prob = (double)bpx_get_integer(p_prob);
            }
            else if (bpx_is_float(p_prob)) {
                prob = bpx_get_float(p_prob);
            }
            else {
                RET_ERR(illegal_arguments);
            }

            if (bpx_is_integer(p_smooth)) {
                smooth = (double)bpx_get_integer(p_smooth);
            }
            else if (bpx_is_float(p_smooth)) {
                smooth = bpx_get_float(p_smooth);
            }
            else {
                RET_ERR(illegal_arguments);
            }

            switch_instances[instance_id]->inside         = prob;
            switch_instances[instance_id]->fixed          = fixed;
            switch_instances[instance_id]->fixed_h        = fixed_h;
            switch_instances[instance_id]->smooth_prolog  = smooth;

            p_instance_list = bpx_get_cdr(p_instance_list);
            p_prob_list     = bpx_get_cdr(p_prob_list);
            p_smooth_list   = bpx_get_cdr(p_smooth_list);
        }
        p_switches = bpx_get_cdr(p_switches);
    }

    return BP_TRUE;
}
开发者ID:davidvaz,项目名称:yap-cmake,代码行数:77,代码来源:graph.c


示例11: bpinit

/*!
* \brief Inizializza il Buffer Pool.
*
* Alloca la memoria per il Buffer di Playout e inizializza la Free List per la gestione interna della memoria.
* Inizializza la variabile di accesso in Mutua Esclusione alla Free List.
*
* \param bp Il puntatore al Buffer Pool corrente.
* \return 1 in caso di errore, 0 altrimenti.
* \see bpkill
* \see bufferpool.h
* */
int bpinit(buffer_pool * bp)
{
        pthread_mutexattr_t mutex_attr;
        int i;

        if (((bp->bufferpool) =
                                (bp_slot *) malloc(BP_SLOT_NUM * sizeof(bp_slot))) == NULL) {
                return 1;
        }
        memset(bp->bufferpool, 0, BP_SLOT_NUM * sizeof(bp_slot));

        bp->freelist = calloc(BP_SLOT_NUM, sizeof(int));

        for (i = 0; i < BP_SLOT_NUM; bp->freelist[i] = i + 1, i++);
        bp->freelist[BP_SLOT_NUM - 1] = -1;
        bp->flhead = 0;
        bp->flcount = 0;
        bp->size = BP_SLOT_NUM;

        if ((i = pthread_mutexattr_init(&mutex_attr)) > 0)
                RET_ERR(i);

        if ((i = pthread_mutex_init(&(bp->fl_mutex), &mutex_attr)) > 0)
                RET_ERR(i);
        // cond initialization
        if ((i = pthread_cond_init(&(bp->cond_full), NULL)) > 0)
                RET_ERR(i);

        return 0;
}
开发者ID:lidongliangfly,项目名称:Libnemesi-reborn,代码行数:41,代码来源:bpinit.c


示例12: examine_inside_scaling_log_exp

int examine_inside_scaling_log_exp(void)
{
    int i;
    double inside;

    /* [23 Aug 2007, by yuizumi]
     * By the code below, inside_failure can take only a non-zero value
     * when `failure' is observed.  We can therefore safely use zero as
     * an indicator of failure being not observed.  Zero is chosen just
     * for convenience in implementation of the parallel version.
     */
    inside_failure = 0.0;

    for (i = 0; i < num_roots; i++) {
        inside = expl_graph[roots[i]->id]->inside;
        if (i == failure_root_index) {
            inside_failure = inside; /* log-scale */
            if (!(inside_failure < 0.0)) {
                emit_error("Probability of failure being unity");
                RET_ERR(err_invalid_numeric_value);
            }
        }
        else {
            if (!isfinite(inside)) {
                emit_error("Probability of an observed goal being non-positive (log_scale: on)");
                RET_ERR(err_invalid_numeric_value);
            }
        }
    }

    return BP_TRUE;
}
开发者ID:v-for-vincent,项目名称:consolidated_thesis,代码行数:32,代码来源:em_aux_ml.c


示例13: strlen

static char *get_sync_dir(alpm_handle_t *handle)
{
	size_t len = strlen(handle->dbpath) + 6;
	char *syncpath;
	struct stat buf;

	MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
	sprintf(syncpath, "%s%s", handle->dbpath, "sync/");

	if(stat(syncpath, &buf) != 0) {
		_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
				syncpath);
		if(_alpm_makepath(syncpath) != 0) {
			free(syncpath);
			RET_ERR(handle, ALPM_ERR_SYSTEM, NULL);
		}
	} else if(!S_ISDIR(buf.st_mode)) {
		_alpm_log(handle, ALPM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
		if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
			free(syncpath);
			RET_ERR(handle, ALPM_ERR_SYSTEM, NULL);
		}
	}

	return syncpath;
}
开发者ID:vadmium,项目名称:pacman-arch,代码行数:26,代码来源:be_sync.c


示例14: CHECK_HANDLE

/** Register a sync database of packages. */
alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle,
		const char *treename, alpm_siglevel_t level)
{
	alpm_list_t *i;

	/* Sanity checks */
	CHECK_HANDLE(handle, return NULL);
	ASSERT(treename != NULL && strlen(treename) != 0,
			RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
	ASSERT(!strchr(treename, '/'), RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
	/* Do not register a database if a transaction is on-going */
	ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL));

	/* ensure database name is unique */
	if(strcmp(treename, "local") == 0) {
		RET_ERR(handle, ALPM_ERR_DB_NOT_NULL, NULL);
	}
	for(i = handle->dbs_sync; i; i = i->next) {
		alpm_db_t *d = i->data;
		if(strcmp(treename, d->treename) == 0) {
			RET_ERR(handle, ALPM_ERR_DB_NOT_NULL, NULL);
		}
	}

	return _alpm_db_register_sync(handle, treename, level);
}
开发者ID:DavidEGrayson,项目名称:MSYS2-pacman,代码行数:27,代码来源:db.c


示例15: alpm_trans_prepare

/** Prepare a transaction. */
int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
{
	alpm_trans_t *trans;

	/* Sanity checks */
	CHECK_HANDLE(handle, return -1);
	ASSERT(data != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));

	trans = handle->trans;

	ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
	ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));

	/* If there's nothing to do, return without complaining */
	if(trans->add == NULL && trans->remove == NULL) {
		return 0;
	}

	alpm_list_t *invalid = check_arch(handle, trans->add);
	if(invalid) {
		if(data) {
			*data = invalid;
		}
		RET_ERR(handle, ALPM_ERR_PKG_INVALID_ARCH, -1);
	}

	if(trans->add == NULL) {
		if(_alpm_remove_prepare(handle, data) == -1) {
			/* pm_errno is set by _alpm_remove_prepare() */
			return -1;
		}
	}	else {
		if(_alpm_sync_prepare(handle, data) == -1) {
			/* pm_errno is set by _alpm_sync_prepare() */
			return -1;
		}
	}


	if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
		_alpm_log(handle, ALPM_LOG_DEBUG, "sorting by dependencies\n");
		if(trans->add) {
			alpm_list_t *add_orig = trans->add;
			trans->add = _alpm_sortbydeps(handle, add_orig, trans->remove, 0);
			alpm_list_free(add_orig);
		}
		if(trans->remove) {
			alpm_list_t *rem_orig = trans->remove;
			trans->remove = _alpm_sortbydeps(handle, rem_orig, NULL, 1);
			alpm_list_free(rem_orig);
		}
	}

	trans->state = STATE_PREPARED;

	return 0;
}
开发者ID:andrewgregory,项目名称:pacman,代码行数:58,代码来源:trans.c


示例16: CALLOC

pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict)
{
	pmconflict_t *newconflict;
	CALLOC(newconflict, 1, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));

	STRDUP(newconflict->package1, conflict->package1, RET_ERR(PM_ERR_MEMORY, NULL));
	STRDUP(newconflict->package2, conflict->package2, RET_ERR(PM_ERR_MEMORY, NULL));

	return(newconflict);
}
开发者ID:LucaLanziani,项目名称:alpm_ruby,代码行数:10,代码来源:conflict.c


示例17: alpm_add_pkg

/** Add a package to the transaction. */
int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
{
	const char *pkgname, *pkgver;
	alpm_trans_t *trans;
	alpm_pkg_t *local;

	/* Sanity checks */
	CHECK_HANDLE(handle, return -1);
	ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
	ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
	trans = handle->trans;
	ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
	ASSERT(trans->state == STATE_INITIALIZED,
			RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));

	pkgname = pkg->name;
	pkgver = pkg->version;

	_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);

	if(alpm_pkg_find(trans->add, pkgname)) {
		RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
	}

	local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
	if(local) {
		const char *localpkgname = local->name;
		const char *localpkgver = local->version;
		int cmp = _alpm_pkg_compare_versions(pkg, local);

		if(cmp == 0) {
			if(trans->flags & ALPM_TRANS_FLAG_NEEDED) {
				/* with the NEEDED flag, packages up to date are not reinstalled */
				_alpm_log(handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
						localpkgname, localpkgver);
				return 0;
			} else if(!(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY)) {
				_alpm_log(handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
						localpkgname, localpkgver);
			}
		} else if(cmp < 0) {
			/* local version is newer */
			_alpm_log(handle, ALPM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
					localpkgname, localpkgver, pkgver);
		}
	}

	/* add the package to the transaction */
	pkg->reason = ALPM_PKG_REASON_EXPLICIT;
	_alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s-%s to the transaction add list\n",
						pkgname, pkgver);
	trans->add = alpm_list_add(trans->add, pkg);

	return 0;
}
开发者ID:jhuntwork,项目名称:pacman,代码行数:56,代码来源:add.c


示例18: local_db_validate

static int local_db_validate(pmdb_t *db)
{
    struct dirent *ent = NULL;
    const char *dbpath;
    DIR *dbdir;
    int ret = -1;

    if(db->status & DB_STATUS_VALID) {
        return 0;
    }

    dbpath = _alpm_db_path(db);
    if(dbpath == NULL) {
        RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
    }
    dbdir = opendir(dbpath);
    if(dbdir == NULL) {
        if(errno == ENOENT) {
            /* database dir doesn't exist yet */
            db->status |= DB_STATUS_VALID;
            return 0;
        } else {
            RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
        }
    }

    while((ent = readdir(dbdir)) != NULL) {
        const char *name = ent->d_name;
        char path[PATH_MAX];

        if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
            continue;
        }
        if(!is_dir(dbpath, ent)) {
            continue;
        }

        snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
        if(access(path, F_OK) == 0) {
            /* we found a depends file- bail */
            db->handle->pm_errno = PM_ERR_DB_VERSION;
            goto done;
        }
    }
    /* we found no depends file after full scan */
    db->status |= DB_STATUS_VALID;
    ret = 0;

done:
    if(dbdir) {
        closedir(dbdir);
    }

    return ret;
}
开发者ID:terralinux,项目名称:pacman,代码行数:55,代码来源:be_local.c


示例19: CALLOC

static struct dload_payload *build_payload(alpm_handle_t *handle,
		const char *filename, size_t size, alpm_list_t *servers)
{
		struct dload_payload *payload;

		CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
		STRDUP(payload->remote_name, filename, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
		payload->max_size = size;
		payload->servers = servers;
		return payload;
}
开发者ID:vadmium,项目名称:pacman-arch,代码行数:11,代码来源:sync.c


示例20: alpm_trans_commit

/** Commit a transaction.
 * @param data the address of an alpm_list where detailed description
 * of an error can be dumped (ie. list of conflicting files)
 * @return 0 on success, -1 on error (pm_errno is set accordingly)
 */
int SYMEXPORT alpm_trans_commit(alpm_list_t **data)
{
	ALPM_LOG_FUNC;

	/* Sanity checks */
	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));

	ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
	ASSERT(handle->trans->state == STATE_PREPARED, RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1));

	return(_alpm_trans_commit(handle->trans, data));
}
开发者ID:LucaLanziani,项目名称:alpm_ruby,代码行数:17,代码来源:trans.c



注:本文中的RET_ERR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ REV32函数代码示例发布时间:2022-05-30
下一篇:
C++ RETVAL_ZVAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap