From 6bd1047a7d08785c35e11d5eb73f1ab85c84766b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 12 May 2020 23:07:23 +0200 Subject: [PATCH] Removed unnecessary static-locals. In this file there's no access to the W5100 auto-increment registers so there's no need for the special compiler settings. However, with "true" local variables the buffer to read the HTTP header into is better not placed in a local variable. Note: The heap manager was already active before as both linenoise and the file I/O use it. --- stream-pdm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stream-pdm.c b/stream-pdm.c index d162668..3cb67c6 100644 --- a/stream-pdm.c +++ b/stream-pdm.c @@ -12,11 +12,6 @@ #include "w5100_http.h" #include "linenoise.h" -// Both pragmas are obligatory to have cc65 generate code -// suitable to access the W5100 auto-increment registers. -#pragma optimize (on) -#pragma static-locals (on) - void streamafterexit(uint8_t eth_init); void error_exit(void) @@ -126,12 +121,14 @@ void main(void) w5100_config(eth_init); { - char buffer[0x1000]; + char *http = malloc(0x1000); - if (!w5100_http_open(url_ip, url_port, url_selector, buffer, sizeof(buffer))) + if (!http || !w5100_http_open(url_ip, url_port, url_selector, http, 0x1000)) { return; } + + free(http); } clrscr();