Changeset 5138


Ignore:
Timestamp:
Feb 27, 2008, 8:07:13 AM (14 years ago)
Author:
charles
Message:

remove unused "label" field. make ipc_havemsg() private. make ipc_parse()'s buf arg const.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/ipcparse.c

    r5137 r5138  
    206206ipc_newcon( struct ipc_funcs * funcs )
    207207{
    208     struct ipc_info * info;
    209 
    210     if(( info = calloc( 1, sizeof *info )))
    211     {
    212         info->funcs = funcs;
    213         info->vers  = -1;
    214     }
    215 
     208    struct ipc_info * info = tr_new0( struct ipc_info, 1 );
     209    info->funcs = funcs;
     210    info->vers  = -1;
    216211    return info;
    217212}
     
    220215ipc_freecon( struct ipc_info * info )
    221216{
    222     if( info )
    223     {
    224         free( info->label );
    225         free( info );
    226     }
     217    tr_free( info );
     218}
     219
     220static int
     221ipc_havemsg( struct ipc_info * info, enum ipc_msg id )
     222{
     223    assert( MSGVALID( id ) );
     224    assert( HASVERS( info ) );
     225
     226    return gl_msgs[id].minvers <= info->vers;
    227227}
    228228
     
    988988
    989989ssize_t
    990 ipc_parse( struct ipc_info * info, uint8_t * buf, ssize_t total, void * arg )
     990ipc_parse( struct ipc_info * info, const uint8_t * buf, ssize_t total, void * arg )
    991991{
    992992    char        hex[IPC_MIN_MSG_LEN+1], * end;
     
    10311031}
    10321032
    1033 int
    1034 ipc_havemsg( struct ipc_info * info, enum ipc_msg id )
    1035 {
    1036     assert( MSGVALID( id ) );
    1037     assert( HASVERS( info ) );
    1038 
    1039     return gl_msgs[id].minvers <= info->vers;
    1040 }
    1041 
    10421033enum ipc_msg
    10431034ipc_msgid( struct ipc_info * info, const char * name )
  • trunk/libtransmission/ipcparse.h

    r5137 r5138  
    123123struct ipc_funcs;
    124124struct ipc_info;
    125 struct strlist;
    126125struct tr_info;
    127126struct tr_benc;
     
    132131    struct ipc_funcs * funcs;
    133132    int                vers;
    134     char             * label;
    135133};
    136134
     
    145143/* setup */
    146144struct ipc_funcs * ipc_initmsgs ( void );
    147 void         ipc_addmsg   ( struct ipc_funcs *, enum ipc_msg, trd_msgfunc );
    148 void         ipc_setdefmsg( struct ipc_funcs *, trd_msgfunc );
    149 void         ipc_freemsgs ( struct ipc_funcs * );
    150 struct ipc_info * ipc_newcon( struct ipc_funcs * );
    151 void         ipc_freecon  ( struct ipc_info * );
     145void               ipc_addmsg   ( struct ipc_funcs *, enum ipc_msg, trd_msgfunc );
     146void               ipc_setdefmsg( struct ipc_funcs *, trd_msgfunc );
     147void               ipc_freemsgs ( struct ipc_funcs * );
     148struct ipc_info *  ipc_newcon   ( struct ipc_funcs * );
     149void               ipc_freecon  ( struct ipc_info * );
    152150
    153151/* message creation */
     
    170168/* sets errno to EINVAL on parse error or
    171169   EPERM for unsupported protocol version */
    172 ssize_t      ipc_parse    ( struct ipc_info *, uint8_t *, ssize_t, void * );
     170ssize_t      ipc_parse    ( struct ipc_info *, const uint8_t *, ssize_t, void * );
    173171
    174172/* misc info functions, these will always succeed */
    175 int          ipc_havemsg  ( struct ipc_info *, enum ipc_msg );
    176173enum ipc_msg ipc_msgid    ( struct ipc_info *, const char * );
    177174int          ipc_ishandled( struct ipc_info *, enum ipc_msg );
Note: See TracChangeset for help on using the changeset viewer.