static tr_benc* get_node (struct jsonsl_st * jsn) { tr_benc * parent; tr_benc * node = NULL; struct json_wrapper_data * data = jsn->data; parent = tr_ptrArrayEmpty (&data->stack) ? NULL : tr_ptrArrayBack (&data->stack); if (!parent) { node = data->top; } else if (tr_bencIsList (parent)) { node = tr_bencListAdd (parent); } else if (tr_bencIsDict (parent) && (data->key!=NULL)) { node = tr_bencDictAdd (parent, data->key); tr_free (data->key); data->key = NULL; } return node; }
static tr_benc* getNode( struct json_benc_data * data ) { tr_benc * parent; tr_benc * node = NULL; if( tr_ptrArrayEmpty( data->stack ) ) parent = NULL; else parent = tr_ptrArrayBack( data->stack ); if( !parent ) node = data->top; else if( tr_bencIsList( parent ) ) node = tr_bencListAdd( parent ); else if( tr_bencIsDict( parent ) && data->key ) { node = tr_bencDictAdd( parent, data->key ); tr_free( data->key ); data->key = NULL; } return node; }