mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
code cleanup (mainly removed line spaces at the beginning of lines by tabulations)
This commit is contained in:
parent
6c3657b702
commit
f3a4197e34
@ -155,7 +155,7 @@ enum {
|
||||
};
|
||||
|
||||
/* reasons -- ie, why the package was installed */
|
||||
#define PM_PKG_REASON_EXPLICIT 0 /* explicitly requested by the user */
|
||||
#define PM_PKG_REASON_EXPLICIT 0 /* explicitly requested by the user */
|
||||
#define PM_PKG_REASON_DEPEND 1 /* installed as a dependency for another package */
|
||||
|
||||
void *alpm_pkg_getinfo(PM_PKG *pkg, unsigned char parm);
|
||||
@ -367,7 +367,7 @@ extern enum __pmerrno_t {
|
||||
|
||||
char *alpm_strerror(int err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -514,25 +514,25 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
|
||||
/* abort */
|
||||
_alpm_log(PM_LOG_ERROR, "package conflicts detected");
|
||||
errorout = 1;
|
||||
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
|
||||
FREELIST(*data);
|
||||
pm_errno = PM_ERR_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
*miss = *(pmdepmissing_t *)i->data;
|
||||
*data = pm_list_add(*data, miss);
|
||||
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
|
||||
FREELIST(*data);
|
||||
pm_errno = PM_ERR_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
*miss = *(pmdepmissing_t *)i->data;
|
||||
*data = pm_list_add(*data, miss);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_alpm_log(PM_LOG_ERROR, "%s conflicts with %s", miss->target, miss->depend.name);
|
||||
errorout = 1;
|
||||
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
|
||||
FREELIST(*data);
|
||||
pm_errno = PM_ERR_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
*miss = *(pmdepmissing_t *)i->data;
|
||||
*data = pm_list_add(*data, miss);
|
||||
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
|
||||
FREELIST(*data);
|
||||
pm_errno = PM_ERR_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
*miss = *(pmdepmissing_t *)i->data;
|
||||
*data = pm_list_add(*data, miss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,8 +328,10 @@ int _alpm_log_action(unsigned char usesyslog, FILE *f, char *fmt, ...)
|
||||
t = time(NULL);
|
||||
tm = localtime(&t);
|
||||
|
||||
fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n", tm->tm_mon+1, tm->tm_mday,
|
||||
tm->tm_year-100, tm->tm_hour, tm->tm_min, msg);
|
||||
fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
|
||||
tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
|
||||
tm->tm_hour, tm->tm_min,
|
||||
msg);
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
@ -1513,8 +1513,8 @@ static int HttpXfer(const char *localfile, const char *path, int *size,
|
||||
* return 1 if successful, 0 otherwise
|
||||
*/
|
||||
GLOBALREF int HttpGet(const char *host, const char *outputfile, const char *path,
|
||||
int *size, netbuf *nControl, unsigned int offset,
|
||||
const struct tm *mtime1, struct tm *mtime2)
|
||||
int *size, netbuf *nControl, unsigned int offset,
|
||||
const struct tm *mtime1, struct tm *mtime2)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
|
@ -467,7 +467,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
|
||||
}
|
||||
} else {
|
||||
if(mtime2) {
|
||||
if(fmtime2.tm_year) {
|
||||
if(fmtime2.tm_year) {
|
||||
/* date conversion from "rfc1123-date" to YYYYMMDDHHMMSS */
|
||||
sprintf(mtime2, "%4d%02d%02d%02d%02d%02d",
|
||||
fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday,
|
||||
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
||||
cleanup(1);
|
||||
}
|
||||
|
||||
for(lp = config->op_s_ignore; lp; lp = lp->next) {
|
||||
for(lp = config->op_s_ignore; lp; lp = lp->next) {
|
||||
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {
|
||||
ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno));
|
||||
cleanup(1);
|
||||
|
@ -66,8 +66,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
|
||||
case PM_TRANS_EVT_ADD_DONE:
|
||||
MSG(CL, "done.\n");
|
||||
snprintf(str, LOG_STR_LEN, "installed %s (%s)",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
alpm_logaction(str);
|
||||
break;
|
||||
case PM_TRANS_EVT_REMOVE_START:
|
||||
@ -86,9 +86,9 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
|
||||
case PM_TRANS_EVT_UPGRADE_DONE:
|
||||
MSG(CL, "done.\n");
|
||||
snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
alpm_logaction(str);
|
||||
break;
|
||||
}
|
||||
@ -101,34 +101,34 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
|
||||
switch(event) {
|
||||
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
|
||||
snprintf(str, LOG_STR_LEN, ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
|
||||
*response = yesno(str);
|
||||
break;
|
||||
case PM_TRANS_CONV_REPLACE_PKG:
|
||||
snprintf(str, LOG_STR_LEN, ":: Replace %s with %s/%s? [Y/n] ",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)data3,
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)data3,
|
||||
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
|
||||
*response = yesno(str);
|
||||
break;
|
||||
case PM_TRANS_CONV_CONFLICT_PKG:
|
||||
snprintf(str, LOG_STR_LEN, "\n:: %s conflicts with %s. Remove %s? [Y/n] ",
|
||||
(char *)data1,
|
||||
(char *)data2,
|
||||
(char *)data2);
|
||||
(char *)data1,
|
||||
(char *)data2,
|
||||
(char *)data2);
|
||||
*response = yesno(str);
|
||||
break;
|
||||
case PM_TRANS_CONV_LOCAL_NEWER:
|
||||
snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
*response = yesno(str);
|
||||
break;
|
||||
case PM_TRANS_CONV_LOCAL_UPTODATE:
|
||||
snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] ",
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
|
||||
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
|
||||
*response = yesno(str);
|
||||
break;
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ int rmrf(char *path)
|
||||
int errflag = 0;
|
||||
struct dirent *dp;
|
||||
DIR *dirp;
|
||||
char name[PATH_MAX];
|
||||
|
||||
if(!unlink(path)) {
|
||||
return(0);
|
||||
@ -102,6 +101,7 @@ int rmrf(char *path)
|
||||
}
|
||||
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
||||
if(dp->d_ino) {
|
||||
char name[PATH_MAX];
|
||||
sprintf(name, "%s/%s", path, dp->d_name);
|
||||
if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, ".")) {
|
||||
errflag += rmrf(name);
|
||||
|
@ -21,10 +21,17 @@
|
||||
#ifndef _PM_UTIL_H
|
||||
#define _PM_UTIL_H
|
||||
|
||||
#define MALLOC(p, b) do { if((b) > 0) { \
|
||||
p = malloc(b); if (!(p)) { \
|
||||
fprintf(stderr, "malloc failure: could not allocate %d bytes\n", b); \
|
||||
exit(1); }} else p = NULL; } while(0)
|
||||
#define MALLOC(p, b) do { \
|
||||
if((b) > 0) { \
|
||||
p = malloc(b); \
|
||||
if (!(p)) { \
|
||||
fprintf(stderr, "malloc failure: could not allocate %d bytes\n", b); \
|
||||
exit(1); \
|
||||
} \
|
||||
} else { \
|
||||
p = NULL; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define FREE(p) do { if (p) { free(p); (p) = NULL; }} while(0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user