Skip to content

Commit

Permalink
2014-07-02 20:56 UTC+0200 Viktor Szakats (vszakats users.noreply.gith…
Browse files Browse the repository at this point in the history
…ub.com)

  * contrib/hbcurl/global.c
    ! memory allocation wrappers updated to better mimic behavior
      of standard malloc()/realloc()/free()/calloc()
      It is particularly important to let free() silently accept NULL
      argument. [I chose zero size allocations to return NULL.]
    ; Cricital update for anyone using libcurl 7.36.0 or newer

  * README.md
    + Thanks note to donators!
  • Loading branch information
vszakats committed Jul 2, 2014
1 parent e81a1de commit 35ffdc1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
11 changes: 11 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
See license at the end of file. */

2014-07-02 20:56 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbcurl/global.c
! memory allocation wrappers updated to better mimic behavior
of standard malloc()/realloc()/free()/calloc()
It is particularly important to let free() silently accept NULL
argument. [I chose zero size allocations to return NULL.]
; Cricital update for anyone using libcurl 7.36.0 or newer

* README.md
+ Thanks note to donators!

2014-07-02 16:40 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbcurl/hbcurl.hbp
+ added new location of dll dependencies on win
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ and interfaces to many popular APIs.

You can donate to fund further maintenance of this fork:

* [Gittip](https://www.gittip.com/vszakats/) [![Gittip](http://img.shields.io/gittip/vszakats.svg)](https://www.gittip.com/vszakats/)
* [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BPSZQYKXMQJYG)
* [Bitcoin](https://coinbase.com/checkouts/b90e7d8467c3d17f0083f9ad186c3c36)

Thanks to those who did.


# How to Get
Expand Down
19 changes: 13 additions & 6 deletions contrib/hbcurl/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@

static void * hb_curl_xgrab( size_t size )
{
return hb_xgrab( size );
return size > 0 ? hb_xgrab( size ) : NULL;
}

static void hb_curl_xfree( void * p )
{
hb_xfree( p );
if( p )
hb_xfree( p );
}

static void * hb_curl_xrealloc( void * p, size_t size )
{
return hb_xrealloc( p, size );
return size > 0 ? ( p ? hb_xrealloc( p, size ) : hb_xgrab( size ) ) : NULL;
}

static char * hb_curl_strdup( const char * s )
Expand All @@ -71,11 +72,17 @@ static char * hb_curl_strdup( const char * s )
static void * hb_curl_calloc( size_t nelem, size_t elsize )
{
size_t size = nelem * elsize;
void * ptr = hb_xgrab( size );

memset( ptr, 0, size );
if( size > 0 )
{
void * ptr = hb_xgrab( size );

return ptr;
memset( ptr, 0, size );

return ptr;
}
else
return NULL;
}

HB_FUNC( CURL_GLOBAL_INIT )
Expand Down

0 comments on commit 35ffdc1

Please sign in to comment.