本文整理汇总了C++中FREEUP函数的典型用法代码示例。如果您正苦于以下问题:C++ FREEUP函数的具体用法?C++ FREEUP怎么用?C++ FREEUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FREEUP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readPIMBuf
static char *
readPIMBuf(char *pfile)
{
char *fname="readPIMBuf";
struct stat bstat;
FILE *fp;
FREEUP(pimInfoBuf);
pimInfoLen = 0;
if (stat(pfile,&bstat) < 0) {
ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL_M, fname, "stat", pfile);
return(NULL);
}
pimInfoLen = bstat.st_size;
if ((pimInfoBuf = (char *)malloc(pimInfoLen+1)) == NULL) {
ls_syslog(LOG_ERR, I18N_FUNC_FAIL_M, fname, "malloc");
return(NULL);
}
if ((fp = openPIMFile(pfile)) == NULL) {
ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL_M, fname, "openPIMFile", pfile);
return (FALSE);
}
if (fread(pimInfoBuf,sizeof(char),pimInfoLen,fp) <= 0) {
ls_syslog(LOG_ERR, I18N_FUNC_FAIL_M, fname, "fread");
FREEUP(pimInfoBuf);
return(NULL);
}
fclose(fp);
pimInfoBuf[pimInfoLen] = '\0';
return(pimInfoBuf);
}
示例2: freeResVal
void
freeResVal(struct resVal *resVal)
{
struct _rusage_ *r;
if (resVal == NULL)
return;
FREEUP(resVal->indicies);
FREEUP(resVal->selectStr);
resVal->selectStrSize = 0;
if (resVal->xorExprs) {
int i;
for (i = 0; resVal->xorExprs[i]; i++)
FREEUP(resVal->xorExprs[i]);
FREEUP(resVal->xorExprs);
}
_free_(resVal->val);
_free_(resVal->rusage_bit_map);
while ((r = pop_link(resVal->rl))) {
_free_(r->bitmap);
_free_(r->val);
_free_(r);
}
fin_link(resVal->rl);
}
示例3: lsb_getlimits
/* lsb_getlimits()
*/
struct resLimitReply *
lsb_getlimits()
{
XDR xdrs;
struct LSFHeader hdr;
char *reply;
int cc;
char buf[sizeof(struct LSFHeader)];
struct resLimitReply *limitReply;
initLSFHeader_(&hdr);
hdr.opCode = BATCH_RESLIMIT_INFO;
xdrmem_create(&xdrs, buf, sizeof(struct LSFHeader), XDR_ENCODE);
if (! xdr_LSFHeader(&xdrs, &hdr)) {
lsberrno = LSBE_XDR;
xdr_destroy(&xdrs);
return NULL;
}
reply = NULL;
cc = callmbd(NULL,
buf,
XDR_GETPOS(&xdrs),
&reply,
&hdr,
NULL,
NULL,
NULL);
if (cc < 0) {
xdr_destroy(&xdrs);
lsberrno = LSBE_PROTOCOL;
return NULL;
}
xdr_destroy(&xdrs);
if (hdr.opCode != LSBE_NO_ERROR) {
FREEUP(reply);
lsberrno = hdr.opCode;
return NULL;
}
xdrmem_create(&xdrs, reply, XDR_DECODE_SIZE_(cc), XDR_DECODE);
limitReply = calloc(1, sizeof(struct resLimitReply));
if(!xdr_resLimitReply(&xdrs, limitReply, &hdr)) {
lsberrno = LSBE_XDR;
xdr_destroy(&xdrs);
if (cc) {
FREEUP(reply);
FREEUP(limitReply);
}
return NULL;
}
xdr_destroy(&xdrs);
if (cc)
FREEUP(reply);
return limitReply;
}
示例4: copyAdmins_
static int
copyAdmins_ (struct clusterInfo *clusPtr, struct shortCInfo *clusShort)
{
int i, j;
if (clusShort->nAdmins <= 0)
return 0;
clusPtr->adminIds = calloc (clusShort->nAdmins, sizeof (int));
clusPtr->admins = calloc (clusShort->nAdmins, sizeof (char *));
if (!clusPtr->admins || !clusPtr->adminIds)
goto errReturn;
for (i = 0; i < clusShort->nAdmins; i++)
{
clusPtr->admins[i] = NULL;
clusPtr->adminIds[i] = clusShort->adminIds[i];
clusPtr->admins[i] = putstr_ (clusShort->admins[i]);
if (clusPtr->admins[i] == NULL)
{
for (j = 0; j < i; j++)
FREEUP (clusPtr->admins[j]);
goto errReturn;
}
}
return 0;
errReturn:
FREEUP (clusPtr->admins);
FREEUP (clusPtr->adminIds);
lserrno = LSE_MALLOC;
return (-1);
}
示例5: ls_rtask
int
ls_rtask(char *host, char **argv, int options)
{
char **envp;
int numEnv;
int ret;
for (numEnv = 0; environ[numEnv]; numEnv++)
;
envp = (char **)calloc(numEnv + 1, sizeof(char *));
for (numEnv = 0; environ[numEnv]; numEnv ++)
envp[numEnv] = strdup(environ[numEnv]);
envp[numEnv] = NULL;
ret = ls_rtaske(host, argv, options, envp);
if (envp) {
for (numEnv = 0; envp[numEnv]; numEnv++)
FREEUP(envp[numEnv]);
FREEUP(envp);
}
return ret;
}
示例6: getEAuth
static int
getEAuth(struct eauth *eauth, char *host)
{
char *argv[4];
char path[MAXPATHLEN];
struct lenData ld;
memset(path,0,sizeof(path));
ls_strcat(path,sizeof(path),genParams_[LSF_SERVERDIR].paramValue);
ls_strcat(path,sizeof(path),"/");
ls_strcat(path,sizeof(path),EAUTHNAME);
argv[0] = path;
argv[1] = "-c";
argv[2] = host;
argv[3] = NULL;
if (logclass & LC_TRACE)
ls_syslog(LOG_DEBUG, "runEAuth(): path=<%s>", path);
if (runEClient_(&ld, argv) == -1) {
if (logclass & (LC_AUTH |LC_TRACE))
ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, "runEAuth", "runEClient", path);
lserrno = LSE_EAUTH;
return -1;
}
if (ld.len == 0) {
if (logclass & (LC_AUTH |LC_TRACE))
ls_syslog(LOG_DEBUG, "runEAuth: <%s> got no data", path);
FREEUP(ld.data);
lserrno = LSE_EAUTH;
return -1;
}
if (ld.len > EAUTH_SIZE) {
if (logclass & (LC_AUTH |LC_TRACE))
ls_syslog(LOG_DEBUG, "runEAuth: <%s> got too much data, size=%d",
path, ld.len);
FREEUP(ld.data);
lserrno = LSE_EAUTH;
return -1;
}
memcpy(eauth->data, ld.data, ld.len);
eauth->data[ld.len] = '\0';
if (logclass & (LC_AUTH |LC_TRACE))
ls_syslog(LOG_DEBUG, "runEAuth: <%s> got data=%s",
path, ld.data);
eauth->len = ld.len;
FREEUP(ld.data);
if (logclass & (LC_AUTH |LC_TRACE))
ls_syslog(LOG_DEBUG, "runEAuth: <%s> got len=%d",
path, ld.len);
return 0;
}
示例7: mapValues
int
mapValues(struct keymap *keyList, char *line)
{
int pos = 0;
char *value;
int i = 0;
int found;
int numv = 0;
while (keyList[i].key != NULL) {
FREEUP (keyList[i].val);
if (keyList[i].position != -1)
numv++;
i++;
}
while ((value = getNextValue(&line)) != NULL) {
i=0;
found = FALSE;
while (keyList[i].key != NULL) {
if (keyList[i].position != pos) {
i++;
continue;
}
if (strcmp (value, "-") == 0)
keyList[i].val = putstr_("");
else {
if (keyList[i].val != NULL)
FREEUP (keyList[i].val);
keyList[i].val = putstr_(value);
}
found = TRUE;
break;
}
if (! found)
goto fail;
pos++;
}
if (pos != numv)
goto fail;
return 0;
fail:
i=0;
while (keyList[i].key != NULL) {
if (keyList[i].val != NULL) {
free(keyList[i].val);
keyList[i].val = NULL;
}
i++;
}
return -1;
}
示例8: printsummary
static void
printsummary (void)
{
char localTimeStrBegin[60];
char localTimeStrEnd[60];
char *buf1, *buf2, *buf3, *buf4, *buf5;
if (tottasks == 0)
return;
strcpy (localTimeStrBegin, _i18n_ctime (ls_catd, 1, &actual_start.begin));
strcpy (localTimeStrEnd, _i18n_ctime (ls_catd, 1, &actual_start.end));
printf (_i18n_msg_get (ls_catd, NL_SETN, 1231, "Summary of %d task(s). (Exit status zero: %d; exit status non-zero: %d).\n"), /* catgets 1231 */
tottasks, totstatz, totstatnz);
sprintf (printline, _i18n_msg_get (ls_catd, NL_SETN, 1232, "Started between %s and %s"), /* catgets 1232 */
localTimeStrBegin, localTimeStrEnd);
printf ("%s", printline);
strcpy (localTimeStrBegin,
_i18n_ctime (ls_catd, 1, &actual_complete.begin));
strcpy (localTimeStrEnd, _i18n_ctime (ls_catd, 1, &actual_complete.end));
sprintf (printline, _i18n_msg_get (ls_catd, NL_SETN, 1234, "Completed between %s and %s"), /* catgets 1234 */
localTimeStrBegin, localTimeStrEnd);
printf ("%s\n", printline);
buf1 = putstr_ (_i18n_msg_get (ls_catd, NL_SETN, 1236, "Resource")); /* catgets 1236 */
buf2 = putstr_ (_i18n_msg_get (ls_catd, NL_SETN, 1237, "Total")); /* catgets 1237 */
buf3 = putstr_ (_i18n_msg_get (ls_catd, NL_SETN, 1238, "Average")); /* catgets 1238 */
buf4 = putstr_ (_i18n_msg_get (ls_catd, NL_SETN, 1239, "Maximum")); /* catgets 1239 */
buf5 = putstr_ (_i18n_msg_get (ls_catd, NL_SETN, 1240, "Minimum")); /* catgets 1240 */
printf (" %-30s%12s%12s%12s%12s\n", buf1, buf2, buf3, buf4, buf5);
FREEUP (buf1);
FREEUP (buf2);
FREEUP (buf3);
FREEUP (buf4);
FREEUP (buf5);
printresuse (cpu, _i18n_msg_get (ls_catd, NL_SETN, 1241, "CPU time (seconds):")); /* catgets 1241 */
printresuse (pf, _i18n_msg_get (ls_catd, NL_SETN, 1242, "Page faults:")); /* catgets 1242 */
printresuse (swaps, _i18n_msg_get (ls_catd, NL_SETN, 1243, "Swaps:")); /* catgets 1243 */
printresuse (bin, _i18n_msg_get (ls_catd, NL_SETN, 1244, "Block input:")); /* catgets 1244 */
printresuse (bout, _i18n_msg_get (ls_catd, NL_SETN, 1245, "Block output:")); /* catgets 1245 */
printresuse (msgs, _i18n_msg_get (ls_catd, NL_SETN, 1246, "Messages sent:")); /* catgets 1246 */
printresuse (msgr, _i18n_msg_get (ls_catd, NL_SETN, 1247, "Messages received:")); /* catgets 1247 */
printresuse (vcsw, _i18n_msg_get (ls_catd, NL_SETN, 1248, "Voluntary context switches:")); /* catgets 1248 */
printresuse (ivcsw, _i18n_msg_get (ls_catd, NL_SETN, 1249, "Involuntary context switches:")); /* catgets 1249 */
printresuse (turn, _i18n_msg_get (ls_catd, NL_SETN, 1250, "Turnaround time (seconds):")); /* catgets 1250 */
}
示例9: xdr_thresholds
static int
xdr_thresholds(XDR *xdrs, struct jobSpecs *jobSpecs)
{
static char fname[] = "xdr_thresholds";
int i, j;
if (xdrs->x_op == XDR_DECODE) {
jobSpecs->thresholds.loadSched = NULL;
jobSpecs->thresholds.loadStop = NULL;
}
if (xdrs->x_op == XDR_FREE) {
for(i=0; i < jobSpecs->thresholds.nThresholds; i++) {
FREEUP(jobSpecs->thresholds.loadSched[i]);
FREEUP(jobSpecs->thresholds.loadStop[i]);
}
FREEUP(jobSpecs->thresholds.loadSched);
FREEUP(jobSpecs->thresholds.loadStop);
return(TRUE);
}
if (!(xdr_int(xdrs, &jobSpecs->thresholds.nIdx) &&
xdr_int(xdrs, &jobSpecs->thresholds.nThresholds))) {
ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname,
lsb_jobid2str(jobSpecs->jobId),
"xdr_int", "nIdx/nThresholds");
return(FALSE);
}
if (xdrs->x_op == XDR_DECODE) {
jobSpecs->thresholds.loadSched = (float **)
my_calloc (jobSpecs->thresholds.nThresholds, sizeof(float *), fname);
jobSpecs->thresholds.loadStop = (float **)
my_calloc (jobSpecs->thresholds.nThresholds, sizeof(float *), fname);
for (i = 0; i < jobSpecs->thresholds.nThresholds; i++) {
jobSpecs->thresholds.loadSched[i] = (float *)
my_calloc (jobSpecs->thresholds.nIdx, sizeof(float), fname);
jobSpecs->thresholds.loadStop[i] = (float *)
my_calloc (jobSpecs->thresholds.nIdx, sizeof(float), fname);
}
}
for (j = 0; j < jobSpecs->thresholds.nThresholds; j++) {
for (i = 0; i < jobSpecs->thresholds.nIdx; i++) {
if (!(xdr_float(xdrs, &jobSpecs->thresholds.loadStop[j][i]) &&
xdr_float(xdrs, &jobSpecs->thresholds.loadSched[j][i]))) {
ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname,
lsb_jobid2str(jobSpecs->jobId),
"xdr_float", "loadStop/loadSched");
return(FALSE);
}
}
}
return (TRUE);
}
示例10: xdr_sbdPackage1
bool_t
xdr_sbdPackage1 (XDR *xdrs, struct sbdPackage *sbdPackage, struct LSFHeader *hdr)
{
static char fname[] = "xdr_sbdPackage1";
int i;
if (!(xdr_int(xdrs, &sbdPackage->uJobLimit))) {
ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname,
"xdr_int", "uJobLimit");
return(FALSE);
}
if (!(xdr_int(xdrs, &sbdPackage->rusageUpdateRate) &&
xdr_int(xdrs, &sbdPackage->rusageUpdatePercent)))
return(FALSE);
if (!xdr_int(xdrs, &sbdPackage->jobTerminateInterval)) {
ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname,
"xdr_int", "jobTerminateInterval");
return (FALSE);
}
if (xdrs->x_op == XDR_ENCODE || (xdrs->x_op != XDR_FREE)) {
if (!xdr_int(xdrs, &sbdPackage->nAdmins))
return FALSE;
if (xdrs->x_op == XDR_DECODE && sbdPackage->nAdmins > 0) {
sbdPackage->admins
= (char **) calloc (sbdPackage->nAdmins, sizeof (char *));
if (sbdPackage->admins == NULL) {
sbdPackage->nAdmins = 0;
return (FALSE);
}
}
for (i = 0; i < sbdPackage->nAdmins; i++) {
if (!xdr_var_string (xdrs, &sbdPackage->admins[i]))
return (FALSE);
}
}
if (xdrs->x_op == XDR_FREE) {
for (i = 0; i < sbdPackage->nAdmins; i++) {
FREEUP(sbdPackage->admins[i]);
}
FREEUP(sbdPackage->admins);
}
return(TRUE);
}
示例11: copyJData
struct jData *
copyJData(struct jData *jp)
{
struct jData *jData;
struct rqHistory *reqHistory;
int i;
jData = initJData(jp->shared);
if (jData->jobSpoolDir) {
FREEUP(jData->jobSpoolDir);
}
reqHistory = jData->reqHistory;
memcpy((char *)jData, (char *)jp, sizeof(struct jData));
jData->reqHistory = reqHistory;
jData->numRef = 0;
jData->nextJob = NULL;
jData->userName = safeSave(jp->userName);
jData->schedHost = safeSave(jp->schedHost);
jData->uPtr = getUserData(jData->userName);
if (jp->askedPtr) {
jData->askedPtr = (struct askedHost *) my_calloc (jp->numAskedPtr,
sizeof(struct askedHost), "copyJData");
for (i = 0; i < jp->numAskedPtr; i++) {
jData->askedPtr[i].hData = jp->askedPtr[i].hData;
jData->askedPtr[i].priority = jp->askedPtr[i].priority;
}
}
if (jp->jobSpoolDir) {
jData->jobSpoolDir = safeSave(jp->jobSpoolDir);
}
return(jData);
}
示例12: freeGroupInfoReply
void
freeGroupInfoReply (struct groupInfoReply *reply)
{
int i;
if (reply == NULL)
return;
for (i = 0; i < reply->numGroups; i++) {
FREEUP(reply->groups[i].memberList);
}
FREEUP (reply->groups);
}
示例13: displayShareRes
static void
displayShareRes(int argc, char **argv, int index)
{
struct lsbSharedResourceInfo *lsbResourceInfo;
int numRes = 0;
char **resourceNames = NULL, **resources = NULL;
char fname[]="displayShareRes";
if (argc > index) {
if ((resourceNames =
(char **) malloc ((argc - index) * sizeof (char *))) == NULL) {
char i18nBuf[100];
sprintf ( i18nBuf,I18N_FUNC_FAIL,fname,"malloc");
perror( i18nBuf );
exit (-1);
}
numRes = getResourceNames (argc, argv, index, resourceNames);
}
if (numRes > 0)
resources = resourceNames;
TIMEIT(0, (lsbResourceInfo = lsb_sharedresourceinfo (resources, &numRes, NULL, 0)), "lsb_sharedresourceinfo");
if (lsbResourceInfo == NULL) {
if (lsberrno == LSBE_BAD_RESOURCE && resources)
lsb_perror(NULL);
else
lsb_perror("lsb_sharedresourceinfo");
exit(-1);
}
prtResourcesShort(numRes, lsbResourceInfo);
FREEUP(resourceNames);
}
示例14: h_freeRefTab_
void
h_freeRefTab_ (hTab * tabPtr)
{
struct hLinks *hTabEnd, *slotPtr;
hEnt *hEntPtr;
slotPtr = tabPtr->slotPtr;
hTabEnd = &(slotPtr[tabPtr->size]);
for (; slotPtr < hTabEnd; slotPtr++)
{
while (slotPtr != slotPtr->bwPtr)
{
hEntPtr = (hEnt *) slotPtr->bwPtr;
remList_ ((struct hLinks *) hEntPtr);
FREEUP (hEntPtr->keyname);
free (hEntPtr);
}
}
free (tabPtr->slotPtr);
tabPtr->slotPtr = NULL;
tabPtr->numEnts = 0;
}
示例15: updLocalJData
int
updLocalJData (struct jData *jp, struct jData *jpbw)
{
int i;
if (jp->numAskedPtr)
FREEUP (jp->askedPtr);
jp->numAskedPtr = 0;
if (jpbw->askedPtr)
{
jp->askedPtr = (struct askedHost *) my_calloc (jpbw->numAskedPtr,
sizeof (struct
askedHost),
"updLocalJData");
for (i = 0; i < jpbw->numAskedPtr; i++)
{
jp->askedPtr[i].hData = jpbw->askedPtr[i].hData;
jp->askedPtr[i].priority = jpbw->askedPtr[i].priority;
}
jp->numAskedPtr = jpbw->numAskedPtr;
}
jp->jFlags &= ~JFLAG_DEPCOND_INVALID;
return (LSBE_NO_ERROR);
}