mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Allocation debugging, reduce SSL structure size.
This commit is contained in:
@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Cameron Rich
|
||||
*
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the axTLS project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* * Neither the name of the axTLS project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
@ -37,17 +37,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "os_port.h"
|
||||
|
||||
#ifdef WIN32
|
||||
/**
|
||||
* gettimeofday() not in Win32
|
||||
* gettimeofday() not in Win32
|
||||
*/
|
||||
EXP_FUNC void STDCALL gettimeofday(struct timeval* t, void* timezone)
|
||||
{
|
||||
{
|
||||
#if defined(_WIN32_WCE)
|
||||
t->tv_sec = time(NULL);
|
||||
t->tv_usec = 0; /* 1sec precision only */
|
||||
t->tv_usec = 0; /* 1sec precision only */
|
||||
#else
|
||||
struct _timeb timebuffer;
|
||||
_ftime(&timebuffer);
|
||||
@ -86,7 +87,7 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size)
|
||||
|
||||
RegQueryValueEx(hKey, "Domain", NULL, &datatype, buf, &bufferlength);
|
||||
RegCloseKey(hKey);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -96,63 +97,3 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size)
|
||||
|
||||
static const char * out_of_mem_str = "out of memory";
|
||||
static const char * file_open_str = "Could not open file \"%s\"";
|
||||
|
||||
/*
|
||||
* Some functions that call display some error trace and then call abort().
|
||||
* This just makes life much easier on embedded systems, since we're
|
||||
* suffering major trauma...
|
||||
*/
|
||||
EXP_FUNC void * STDCALL ax_malloc(size_t s)
|
||||
{
|
||||
void *x;
|
||||
|
||||
if ((x = malloc(s)) == NULL)
|
||||
exit_now(out_of_mem_str);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
EXP_FUNC void * STDCALL ax_realloc(void *y, size_t s)
|
||||
{
|
||||
void *x;
|
||||
|
||||
if ((x = realloc(y, s)) == NULL)
|
||||
exit_now(out_of_mem_str);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
EXP_FUNC void * STDCALL ax_calloc(size_t n, size_t s)
|
||||
{
|
||||
void *x;
|
||||
|
||||
if ((x = calloc(n, s)) == NULL)
|
||||
exit_now(out_of_mem_str);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
EXP_FUNC int STDCALL ax_open(const char *pathname, int flags)
|
||||
{
|
||||
int x;
|
||||
|
||||
if ((x = open(pathname, flags)) < 0)
|
||||
exit_now(file_open_str, pathname);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a call which will deliberately exit an application, but will
|
||||
* display some information before dying.
|
||||
*/
|
||||
void exit_now(const char *format, ...)
|
||||
{
|
||||
va_list argp;
|
||||
|
||||
va_start(argp, format);
|
||||
vfprintf(stderr, format, argp);
|
||||
va_end(argp);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user