Ignore:
Timestamp:
2013-02-26T16:43:56+01:00 (11 years ago)
Author:
hkiel
Message:
  • add some "static" keywords
  • stop file compare when first difference occured
  • use cached WinLibPath
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/runtime/printimpl.c

    r15318 r15338  
    3636#include "systemimpl.h"
    3737
    38 /* adrpo: this is defined in errorext. (enabled with omc +showErrorMessages) */
    39 extern int showErrorMessages;
     38/* adrpo: "int showErrorMessages" is defined in errorext. (enabled with omc +showErrorMessages) */
    4039
    4140#define GROWTH_FACTOR 1.4  /* According to some rumors of buffer growth */
     
    5049#define errorCursize Print_var_errorCursize
    5150
    52 char *buf = NULL;
    53 char *errorBuf = NULL;
    54 
    55 int nfilled=0;
    56 int cursize=0;
    57 
    58 int errorNfilled=0;
    59 int errorCursize=0;
    60 
    61  char** savedBuffers=0;
    62  long* savedCurSize;
    63  long* savedNfilled;
     51static char *buf = NULL;
     52static char *errorBuf = NULL;
     53
     54static int nfilled=0;
     55static int cursize=0;
     56
     57static int errorNfilled=0;
     58static int errorCursize=0;
     59
     60static char** savedBuffers=0;
     61static long* savedCurSize;
     62static long* savedNfilled;
    6463
    6564static int increase_buffer(void)
     
    136135}
    137136
    138 int print_error_buf_impl(const char *str)
     137static int print_error_buf_impl(const char *str)
    139138{
    140139  /*  printf("cursize: %d, nfilled %d, strlen: %d\n",cursize,nfilled,strlen(str));*/
     
    242241
    243242/* returns NULL on failure */
    244 const char* PrintImpl__getString(void)
     243static const char* PrintImpl__getString(void)
    245244{
    246245  if(buf == NULL || buf[0]=='\0' || cursize==0){
     
    360359    savedCurSize[handle] = 0;
    361360    savedNfilled[handle] = 0;
    362     if (buf == 0) { 
     361    if (buf == 0) {
    363362      fprintf(stderr,"Internal error, handle %d does not contain a valid buffer pointer\n",handle);
    364363      return 1;
     
    372371  long freeHandle,foundHandle=0;
    373372
    374   if (! savedBuffers) { 
     373  if (! savedBuffers) {
    375374    savedBuffers = (char**)malloc(MAXSAVEDBUFFERS*sizeof(char*));
    376     if (!savedBuffers) { 
     375    if (!savedBuffers) {
    377376      fprintf(stderr, "Internal error allocating savedBuffers in Print.saveAndClearBuf\n");
    378377      return -1;
     
    380379    memset(savedBuffers,0,MAXSAVEDBUFFERS);
    381380  }
    382   if (! savedCurSize) { 
     381  if (! savedCurSize) {
    383382    savedCurSize = (long*)malloc(MAXSAVEDBUFFERS*sizeof(long*));
    384     if (!savedCurSize) { 
     383    if (!savedCurSize) {
    385384      fprintf(stderr, "Internal error allocating savedCurSize in Print.saveAndClearBuf\n");
    386385      return -1;
     
    388387    memset(savedCurSize,0,MAXSAVEDBUFFERS);
    389388  }
    390   if (! savedNfilled) { 
     389  if (! savedNfilled) {
    391390    savedNfilled = (long*)malloc(MAXSAVEDBUFFERS*sizeof(long*));
    392     if (!savedNfilled) { 
     391    if (!savedNfilled) {
    393392      fprintf(stderr, "Internal error allocating savedNfilled in Print.saveAndClearBuf\n");
    394393      return -1;
Note: See TracChangeset for help on using the changeset viewer.