mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
add more NULL prt checks in strtok_r
Conflicts: libraries/SD/src/SD.cpp libraries/SD/src/SD.h
This commit is contained in:
@ -30,39 +30,32 @@ void timer1_isr_handler(void *para){
|
||||
if(timer1_user_cb) timer1_user_cb();
|
||||
}
|
||||
|
||||
extern void __timer1_isr_init(){
|
||||
void timer1_isr_init(){
|
||||
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
|
||||
}
|
||||
|
||||
extern void __timer1_attachInterrupt(void (*userFunc)(void)) {
|
||||
void timer1_attachInterrupt(void (*userFunc)(void)) {
|
||||
timer1_user_cb = userFunc;
|
||||
ETS_FRC1_INTR_ENABLE();
|
||||
}
|
||||
|
||||
extern void __timer1_detachInterrupt() {
|
||||
void timer1_detachInterrupt() {
|
||||
timer1_user_cb = 0;
|
||||
TEIE &= ~TEIE1;//edge int disable
|
||||
ETS_FRC1_INTR_DISABLE();
|
||||
}
|
||||
|
||||
extern void __timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
|
||||
void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
|
||||
T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
|
||||
T1I = 0;
|
||||
}
|
||||
|
||||
extern void __timer1_write(uint32_t ticks){
|
||||
void timer1_write(uint32_t ticks){
|
||||
T1L = ((ticks) & 0x7FFFFF);
|
||||
if((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
|
||||
}
|
||||
|
||||
extern void __timer1_disable(){
|
||||
void timer1_disable(){
|
||||
T1C = 0;
|
||||
T1I = 0;
|
||||
}
|
||||
|
||||
extern void timer1_isr_init(void) __attribute__ ((weak, alias("__timer1_isr_init")));
|
||||
extern void timer1_detachInterrupt(void) __attribute__ ((weak, alias("__timer1_detachInterrupt")));
|
||||
extern void timer1_disable(void) __attribute__ ((weak, alias("__timer1_disable")));
|
||||
extern void timer1_attachInterrupt(void (*userFunc)(void)) __attribute__ ((weak, alias("__timer1_attachInterrupt")));
|
||||
extern void timer1_write(uint32_t ticks) __attribute__ ((weak, alias("__timer1_write")));
|
||||
extern void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload) __attribute__ ((weak, alias("__timer1_enable")));
|
@ -175,6 +175,9 @@ char* ICACHE_FLASH_ATTR strtok_r(char * str, const char * delimiters, char ** te
|
||||
uint32_t size = 0;
|
||||
|
||||
if(str == NULL) {
|
||||
if(temp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
start = *temp;
|
||||
} else {
|
||||
start = str;
|
||||
@ -184,6 +187,10 @@ char* ICACHE_FLASH_ATTR strtok_r(char * str, const char * delimiters, char ** te
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(delimiters == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
end = start;
|
||||
|
||||
while(1) {
|
||||
@ -211,7 +218,9 @@ char* ICACHE_FLASH_ATTR strtok_r(char * str, const char * delimiters, char ** te
|
||||
}
|
||||
|
||||
char* ICACHE_FLASH_ATTR strtok(char * str, const char * delimiters) {
|
||||
return strtok_r(str, delimiters, NULL);
|
||||
static char * ret = NULL;
|
||||
ret = strtok_r(str, delimiters, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int strcasecmp(const char * str1, const char * str2) {
|
||||
|
Reference in New Issue
Block a user