Changeset 5816:6c593d184ef2 in roaraudio for libroar


Ignore:
Timestamp:
01/05/13 14:31:33 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

improved service interface even more, allow creation of a simple interface object to access functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/roardl.c

    r5815 r5816  
    10281028} 
    10291029 
    1030 const void * libroar_dl_service_get_api(struct roar_dl_librarypara * para, const char * appname, const char * appabi, const char * servicename, const char * serviceabi, int universal, struct roar_dl_lhandle ** lhandle) { 
     1030int libroar_dl_service_get_api_real(struct roar_dl_librarypara * para, const char * appname, const char * appabi, const char * servicename, const char * serviceabi, int universal, struct roar_dl_service_api * api) { 
    10311031 const struct roar_dl_service * s; 
    10321032 struct __fnregs * c = NULL; 
    10331033 size_t i; 
     1034 int err; 
     1035 
     1036 if ( para == NULL || servicename == NULL || serviceabi == NULL || api == NULL ) { 
     1037  roar_err_set(ROAR_ERROR_FAULT); 
     1038  return -1; 
     1039 } 
     1040 
     1041 memset(api, 0, sizeof(struct roar_dl_service_api)); 
    10341042 
    10351043 for (i = 0; i < __MAX_FNREGS; i++) { 
     
    10621070   continue; 
    10631071 
    1064   if ( lhandle != NULL ) { 
    1065    if ( roar_dl_ref(c->lhandle) != 0 ) 
    1066     continue; 
    1067    *lhandle = c->lhandle; 
    1068   } 
    1069  
    1070   return s->get_api(s, para); 
     1072  if ( roar_dl_ref(c->lhandle) != 0 ) 
     1073   continue; 
     1074 
     1075  api->lhandle = c->lhandle; 
     1076 
     1077  api->api = s->get_api(s, para); 
     1078  if ( api->api == NULL ) { 
     1079   err = roar_error; 
     1080   roar_dl_unref(c->lhandle); 
     1081   api->lhandle = NULL; 
     1082   roar_error = err; 
     1083   return -1; 
     1084  } 
     1085 
     1086  return 0; 
    10711087 } 
    10721088 
    10731089 roar_err_set(ROAR_ERROR_NOENT); 
    1074  return NULL; 
     1090 return -1; 
     1091} 
     1092 
     1093int libroar_dl_service_free_api_real(struct roar_dl_service_api * api) { 
     1094 if ( api == NULL ) { 
     1095  roar_err_set(ROAR_ERROR_FAULT); 
     1096  return -1; 
     1097 } 
     1098 
     1099 roar_dl_unref(api->lhandle); 
     1100 
     1101 memset(api, 0, sizeof(struct roar_dl_service_api)); 
     1102 
     1103 return 0; 
    10751104} 
    10761105 
Note: See TracChangeset for help on using the changeset viewer.