Changeset 2672:7c6d666bfd79 in roaraudio


Ignore:
Timestamp:
09/12/09 22:58:10 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added new pcb (*new_child)(*), wrote cont_fw_new_child()

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/container_framework.c

    r2671 r2672  
    9494// VIOs: 
    9595int     cont_fw_new_child(struct cont_fw_parent_inst  * inst, int id) { 
    96  if ( inst == NULL ) 
    97   return -1; 
    98  
    99  return -1; 
     96 struct cont_fw_child_vio_inst * self; 
     97 int i; 
     98 int cid = -1; 
     99 
     100 if ( inst == NULL || id == -1 ) 
     101  return -1; 
     102 
     103 for (i = 0; i < CONT_FW_MAX_CHILDS; i++) { 
     104  if ( inst->child[i] == NULL ) { 
     105   cid = i; 
     106   break; 
     107  } 
     108 } 
     109 
     110 if ( cid == -1 ) 
     111  return -1; 
     112 
     113 if ( (self = malloc(sizeof(struct cont_fw_child_vio_inst))) == NULL ) 
     114  return -1; 
     115 
     116 memset(self, 0, sizeof(struct cont_fw_child_vio_inst)); 
     117 
     118 self->parent = inst; 
     119 self->child  = id; 
     120 self->u_inst = NULL; 
     121 
     122 inst->child[i] = self; 
     123 
     124 if ( inst->pcb.new_child != NULL ) { 
     125  if ( inst->pcb.new_child(inst, self) == -1 ) { 
     126   inst->child[i] = NULL; 
     127   free(self); 
     128   return -1; 
     129  } 
     130 } 
     131 
     132 return 0; 
    100133} 
    101134 
  • roard/include/container_framework.h

    r2669 r2672  
    4848 } ccb; 
    4949 struct { 
    50   int     (*close)(struct cont_fw_parent_inst * self); 
     50  int     (*close    )(struct cont_fw_parent_inst * self); 
     51  int     (*new_child)(struct cont_fw_parent_inst * self, struct cont_fw_child_vio_inst * child); 
    5152 } pcb; 
    5253}; 
Note: See TracChangeset for help on using the changeset viewer.