tried to make faster
This commit is contained in:
parent
afffb11b6a
commit
18adef4857
@ -261,13 +261,13 @@ writef(addr,sz,cnt)
|
|||||||
*/
|
*/
|
||||||
emits(section) struct outsect *section ; {
|
emits(section) struct outsect *section ; {
|
||||||
char *p;
|
char *p;
|
||||||
char *calloc();
|
char *calloc(), *malloc();
|
||||||
long sz = section->os_flen;
|
long sz = section->os_flen;
|
||||||
|
|
||||||
rd_outsect(section - outsect);
|
rd_outsect(section - outsect);
|
||||||
while (sz) {
|
while (sz) {
|
||||||
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
||||||
if (!(p = calloc(i, 1))) {
|
if (!(p = malloc(i))) {
|
||||||
fatal("No memory.\n");
|
fatal("No memory.\n");
|
||||||
}
|
}
|
||||||
rd_emit(p, i);
|
rd_emit(p, i);
|
||||||
@ -279,16 +279,18 @@ emits(section) struct outsect *section ; {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sz = section->os_size - section->os_flen;
|
sz = section->os_size - section->os_flen;
|
||||||
while (sz) {
|
if (sz) {
|
||||||
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
if (!(p = calloc(0x4000, 1))) {
|
||||||
if (!(p = calloc(i, 1))) {
|
|
||||||
fatal("No memory.\n");
|
fatal("No memory.\n");
|
||||||
}
|
}
|
||||||
if (write(output, p, i) < i) {
|
while (sz) {
|
||||||
fatal("write error.\n");
|
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
||||||
|
if (write(output, p, i) < i) {
|
||||||
|
fatal("write error.\n");
|
||||||
|
}
|
||||||
|
sz -= i;
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
sz -= i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -261,13 +261,13 @@ writef(addr,sz,cnt)
|
|||||||
*/
|
*/
|
||||||
emits(section) struct outsect *section ; {
|
emits(section) struct outsect *section ; {
|
||||||
char *p;
|
char *p;
|
||||||
char *calloc();
|
char *calloc(), *malloc();
|
||||||
long sz = section->os_flen;
|
long sz = section->os_flen;
|
||||||
|
|
||||||
rd_outsect(section - outsect);
|
rd_outsect(section - outsect);
|
||||||
while (sz) {
|
while (sz) {
|
||||||
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
||||||
if (!(p = calloc(i, 1))) {
|
if (!(p = malloc(i))) {
|
||||||
fatal("No memory.\n");
|
fatal("No memory.\n");
|
||||||
}
|
}
|
||||||
rd_emit(p, i);
|
rd_emit(p, i);
|
||||||
@ -279,16 +279,18 @@ emits(section) struct outsect *section ; {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sz = section->os_size - section->os_flen;
|
sz = section->os_size - section->os_flen;
|
||||||
while (sz) {
|
if (sz) {
|
||||||
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
if (!(p = calloc(0x4000, 1))) {
|
||||||
if (!(p = calloc(i, 1))) {
|
|
||||||
fatal("No memory.\n");
|
fatal("No memory.\n");
|
||||||
}
|
}
|
||||||
if (write(output, p, i) < i) {
|
while (sz) {
|
||||||
fatal("write error.\n");
|
unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
|
||||||
|
if (write(output, p, i) < i) {
|
||||||
|
fatal("write error.\n");
|
||||||
|
}
|
||||||
|
sz -= i;
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
sz -= i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user