Changeset c232af in git for Singular/feResource.cc


Ignore:
Timestamp:
Aug 14, 2000, 2:58:28 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
d26c2e9dd38f1531c0e77c38e6177109182b5bca
Parents:
4697a8a1ccbf49d0048033ea29c651e3966ba729
Message:
* omalloc stuff


git-svn-id: file:///usr/local/Singular/svn/trunk@4524 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/feResource.cc

    r4697a8a rc232af  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: feResource.cc,v 1.26 2000-05-25 13:37:28 obachman Exp $ */
     4/* $Id: feResource.cc,v 1.27 2000-08-14 12:56:06 obachman Exp $ */
    55/*
    66* ABSTRACT: management of resources
     
    1212#include "distrib.h"
    1313#if !defined(ESINGULAR) && !defined(TSINGULAR)
    14 #include "mmemory.h"
     14#include <omalloc.h>
    1515#include "febase.h"
    16 extern "C" char* find_executable(const char* argv0);
    1716#endif
    1817
     
    111110#define MAXRESOURCELEN 5*MAXPATHLEN
    112111
    113 #ifdef MTRACK
    114 BOOLEAN feRes_works=FALSE;
    115 #endif
    116 
    117112char fePathSep =
    118113#if defined(WINNT)
     
    178173    fePathSep = ':';
    179174#endif
    180   feArgv0 = mstrdup(argv0);
     175  feArgv0 = omStrDup(argv0);
    181176#ifdef RESOURCE_DEBUG
    182177  printf("feInitResources: entering with argv0=%s=\n", argv0);
     
    195190  if (path != NULL) setenv("PATH", path, 1);
    196191#endif
    197 #ifdef MTRACK
    198   feRes_works=TRUE;
    199 #endif
    200192}
    201193
     
    208200    {
    209201      if (feResourceConfigs[i].value != NULL)
    210         FreeL(feResourceConfigs[i].value);
     202        omFree(feResourceConfigs[i].value);
    211203      feResourceConfigs[i].value = "";
    212204    }
     
    261253{
    262254  if (config == NULL) return NULL;
    263   char* value = (char*) AllocL(MAXRESOURCELEN);
     255  char* value = (char*) omAlloc(MAXRESOURCELEN);
    264256  feSprintf(value, config->fmt, -1);
    265257  return value;
     
    293285        printf("feInitResource: Set value of %s to =%s=\n", config->key, value);
    294286#endif
    295         config->value = mstrdup(value);
     287        config->value = omStrDup(value);
    296288        return config->value;
    297289      }
     
    313305      printf("value:%s\n", value);
    314306#endif
    315       FreeL(executable);
     307      omFree(executable);
    316308    }
    317309  }
     
    353345    printf("feInitResource: Set value of %s to =%s=\n", config->key, value);
    354346#endif
    355     config->value = mstrdup(value);
     347    config->value = omStrDup(value);
    356348    return config->value;
    357349  }
     
    359351  {
    360352    // for binaries, search through PATH once more
    361     char* executable = find_executable(config->key);
     353    char* executable = omFindExec(config->key, value);
    362354    if (executable != NULL)
    363355    {
    364       strcpy(value, executable);
    365       FreeL(executable);
    366356      if (feVerifyResourceValue(config->type,
    367357                                feCleanResourceValue(config->type, value)))
    368358      {
    369         config->value = mstrdup(value);
     359        config->value = omStrDup(value);
    370360#ifdef RESOURCE_DEBUG
    371361        printf("feInitResource: Set value of %s to =%s=\n", config->key, config->value);
     
    416406  printf("feGetExpandedExecutable: calling find_exec with =%s=\n", feArgv0);
    417407#endif
    418   char* executable = find_executable(feArgv0);
     408  char executable[MAXRESOURCELEN];
     409  char* value = omFindExec(feArgv0, executable);
    419410#ifdef RESOURCE_DEBUG
    420411  printf("feGetExpandedExecutable: find_exec exited with =%s=%d\n", executable, access(executable, X_OK));
    421412#endif
    422   if (executable == NULL)
     413  if (value == NULL)
    423414  {
    424415    char message[MAXRESOURCELEN];
     
    427418    return NULL;
    428419  }
    429   return executable;
     420  return omStrDup(value);
    430421#else // macintosh
    431422  return feArgv0;
     
    581572  }
    582573
    583   path_comps = (char**) AllocL(n_comps*sizeof(char*));
     574  path_comps = (char**) omAlloc(n_comps*sizeof(char*));
    584575  path_comps[0]=opath;
    585576  path=opath;
     
    661652    *opath = '\0';
    662653  }
    663   FreeL(path_comps);
     654  omFree(path_comps);
    664655#ifdef RESOURCE_DEBUG
    665656  Print("feCleanUpPath: leaving with path=%s=\n", opath);
Note: See TracChangeset for help on using the changeset viewer.