Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.90
 
1.91
 
MAIN:ragge:20080419131406
 
cc.c
_>114114 char    *tmp3;
 115115 char    *tmp4;
 116116 char    *outfile;
<>117 -char *copy(char *),*setsuf(char *, char);
  117+char *copy(char *, int),*setsuf(char *, char);
118118 int getsuf(char *);
 119119 int main(int, char *[]);
 120120 void error(char *, ...);
     
 !
124124 void dexit(int);
 125125 void idexit(int);
 126126 char *gettmp();
<> 127+void *ccmalloc(int size);
127128 char    *av[MAXAV];
 128129 char    *clist[MAXFIL];
 129130 char    *llist[MAXLIB];
     
 !
156157 int     nostdinc, nostdlib;
 157158 int     onlyas;
 158159 int     pthreads;
<> 160+int     xcflag;
159161 
 160162 char    *passp = LIBEXECDIR "/" PREPROCESSOR;
 161163 char    *pass0 = LIBEXECDIR "/" COMPILER;
     
 !
295297                                 if (*t == 0)
 296298                                         t = argv[++i];
 297299                                 if (strcmp(t, "c") == 0)
<>298 -                                        ; /* default */
  300+                                        xcflag = 1; /* default */
299301 #ifdef notyet
 300302                                 else if (strcmp(t, "c++")
 301303                                         cxxflag++;
     
 !
382384                         if (*argv[i] == '-' && argv[i][1] == 'L')
 383385                                 ;
 384386                         else if((c=getsuf(t))=='c' || c=='S' || c=='i' ||
<>385 -                            c=='s'|| Eflag) {
  387+                            c=='s'|| Eflag || xcflag) {
386388                                 clist[nc++] = t;
 387389                                 if (nc>=MAXFIL) {
 388390                                         error("Too many source files");
     
 !
759761 char *
 760762 setsuf(char *s, char ch)
 761763 {
<>762 -        s = copy(basename(s));
 763 -        s[strlen(s) - 1] = ch;
  764+        char *as;
  765+
  766+        s = copy(basename(s), 2);
  767+        if ((as = strrchr(s, '.')) == NULL) {
  768+                as = s + strlen(s);
  769+                as[0] = '.';
  770+        }
  771+        as[1] = ch;
  772+        as[2] = '\0';
764773         return(s);
 765774 }
 766775 
     
 !
860869 }
 861870 #endif
 862871 
<> 872+/*
  873+ * Make a copy of string as, mallocing extra bytes in the string.
  874+ */
863875 char *
<>864 -copy(char *as)
  876+copy(char *as, int extra)
865877 {
<>866 -        char *p;
 867 -
 868 -        if ((p = strdup(as)) == NULL)
 869 -                errorx(8, "no space for file names");
 870 -
 871 -        return p;
  878+        return strcpy(ccmalloc(strlen(as)+extra+1), as);
872879 }
 873880 
 874881 int
     
 !
899906                 fprintf(stderr, "%s:\n", pathBuffer);
 900907                 exit(8);
 901908         }
<>902 -        return copy(tempFilename);
  909+        return copy(tempFilename, 0);
903910 }
 904911 
 905912 #else
 906913 
 907914 char *
 908915 gettmp(void)
 909916 {
<>910 -        char *sfn = copy("/tmp/ctm.XXXXXX");
  917+        char *sfn = copy("/tmp/ctm.XXXXXX", 0);
911918         int fd = -1;
 912919 
 913920         if ((fd = mkstemp(sfn)) == -1) {
     
 !
918925         return sfn;
 919926 }
 920927 #endif
<_ 928+
  929+void *
  930+ccmalloc(int size)
  931+{
  932+        void *rv;
  933+
  934+        if ((rv = malloc(size)) == NULL)
  935+                error("malloc failed");
  936+        return rv;
  937+}
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-20 21:54 +0100