mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Replace malloc by allocate
This commit is contained in:
parent
0737b4f5b2
commit
bd3d69d1ae
2 changed files with 3 additions and 3 deletions
|
@ -55,7 +55,7 @@ static char * escape_name( const char *mark, ssize_t *length )
|
||||||
{
|
{
|
||||||
// Escape the mark.
|
// Escape the mark.
|
||||||
// Max length is twice the old size + trailing \0.
|
// Max length is twice the old size + trailing \0.
|
||||||
char *escaped_mark = malloc( sizeof( char )*( strlen( mark )*2+1 ) );
|
char *escaped_mark = allocate ( sizeof( char )*( strlen( mark )*2+1 ) );
|
||||||
ssize_t lm = strlen( mark );
|
ssize_t lm = strlen( mark );
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ static char ** get_mark ( )
|
||||||
t = recv( s, &head, sizeof( head ),0 );
|
t = recv( s, &head, sizeof( head ),0 );
|
||||||
|
|
||||||
if ( t == sizeof( head ) ) {
|
if ( t == sizeof( head ) ) {
|
||||||
char *result = malloc( sizeof( char )*( head.size+1 ) );
|
char *result = allocate ( sizeof( char )*( head.size+1 ) );
|
||||||
ssize_t index = 0;
|
ssize_t index = 0;
|
||||||
t = 0;
|
t = 0;
|
||||||
|
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ int main( int argc, char *argv[] )
|
||||||
if ( XrmGetResource ( xDB, name, class, &xrmType, &xrmValue ) ) {
|
if ( XrmGetResource ( xDB, name, class, &xrmType, &xrmValue ) ) {
|
||||||
|
|
||||||
if ( xrmOptions[i].type == xrm_String ) {
|
if ( xrmOptions[i].type == xrm_String ) {
|
||||||
*xrmOptions[i].str = ( char * ) malloc ( xrmValue.size * sizeof ( char ) );
|
*xrmOptions[i].str = ( char * ) allocate ( xrmValue.size * sizeof ( char ) );
|
||||||
strncpy ( *xrmOptions[i].str, xrmValue.addr, xrmValue.size );
|
strncpy ( *xrmOptions[i].str, xrmValue.addr, xrmValue.size );
|
||||||
} else if ( xrmOptions[i].type == xrm_Number ) {
|
} else if ( xrmOptions[i].type == xrm_Number ) {
|
||||||
*xrmOptions[i].num = strtol ( xrmValue.addr, NULL, 10 );
|
*xrmOptions[i].num = strtol ( xrmValue.addr, NULL, 10 );
|
||||||
|
|
Loading…
Add table
Reference in a new issue