~ubuntu-branches/ubuntu/utopic/linux86/utopic

« back to all changes in this revision

Viewing changes to as/readsrc.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-07 20:33:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071207203339-uonmnsb2j32kh0sg
Tags: 0.16.17-2ubuntu1
* Merge with Debian; remaining changes:
  - Build elks-libc for lpia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
PRIVATE struct get_s *getstak;  /* ptr */
51
51
 
52
52
#if BIGBUFFER == 1
53
 
PRIVATE char *mem_start, *mem_end;
 
53
PRIVATE char *mem_start = 0, *mem_end;
54
54
#endif
55
55
 
56
56
PRIVATE char hid_linebuf[LINLEN];       /* line buffer */
109
109
#if BIGBUFFER == 1
110
110
    if( mem_start == 0 )
111
111
    {
 
112
        size_t memsize = 0;
 
113
        int cc;
 
114
 
112
115
        if(fd)
113
116
        {
114
117
           struct stat st;
120
123
              goto cant_do_this;
121
124
           }
122
125
        }
123
 
        if( filelength > 0 )
124
 
        {
125
 
           if( (mem_start = malloc(filelength+2)) == 0 )
 
126
 
 
127
        if (filelength > 0) {
 
128
           if( (mem_start = malloc(filelength+4)) == 0 )
126
129
           {
127
130
              mem_end = mem_start = "\n\n";
128
131
              goto cant_do_this;
129
 
           }
 
132
           }
 
133
           memsize = filelength;
 
134
 
130
135
           filelength = read(fd, mem_start, filelength);
131
 
        }
132
 
        else
133
 
        {
134
 
           size_t memsize = 0;
135
 
           int cc;
 
136
        } else
136
137
           filelength = 0;
137
138
 
138
 
           for(;;)
139
 
           {
140
 
               if( filelength >= memsize )
141
 
               {
142
 
                   if (memsize > 16000)
143
 
                       mem_start = asrealloc(mem_start, (memsize+=16384)+4);
144
 
                   else
145
 
                       mem_start = asrealloc(mem_start, (memsize+=memsize+32)+4);
146
 
               }
147
 
               cc = read(fd, mem_start+filelength,
148
 
                             (size_t)(memsize-filelength));
149
 
               if( cc <= 0 ) break;
150
 
               filelength+=cc;
151
 
           }
 
139
        for(;;)
 
140
        {
 
141
            if( filelength >= memsize )
 
142
            {
 
143
                if (memsize > 16000)
 
144
                    mem_start = asrealloc(mem_start, (memsize+=16384)+4);
 
145
                else
 
146
                    mem_start = asrealloc(mem_start, (memsize+=memsize+32)+4);
 
147
            }
 
148
            cc = read(fd, mem_start+filelength,
 
149
                          (size_t)(memsize-filelength));
 
150
            if( cc <= 0 ) break;
 
151
            filelength+=cc;
152
152
        }
 
153
 
153
154
        *(mem_end=mem_start+filelength) = '\n';
154
155
        mem_end[1] = '\0';
155
156