/[gxemul]/trunk/src/devices/dev_sn.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_sn.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 10 by dpavlin, Mon Oct 8 16:18:27 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_sn.c,v 1.10 2005/03/14 19:14:02 debug Exp $   *  $Id: dev_sn.c,v 1.11 2005/06/26 11:43:48 debug Exp $
29   *     *  
30   *  National Semiconductor SONIC ("sn") DP83932 ethernet.   *  National Semiconductor SONIC ("sn") DP83932 ethernet.
31   *   *
# Line 103  int dev_sn_access(struct cpu *cpu, struc Line 103  int dev_sn_access(struct cpu *cpu, struc
103  int devinit_sn(struct devinit *devinit)  int devinit_sn(struct devinit *devinit)
104  {  {
105          char *name2;          char *name2;
106            size_t nlen = 55;
107          struct sn_data *d = malloc(sizeof(struct sn_data));          struct sn_data *d = malloc(sizeof(struct sn_data));
108    
109          if (d == NULL) {          if (d == NULL) {
# Line 114  int devinit_sn(struct devinit *devinit) Line 115  int devinit_sn(struct devinit *devinit)
115    
116          net_generate_unique_mac(devinit->machine, d->macaddr);          net_generate_unique_mac(devinit->machine, d->macaddr);
117    
118          name2 = malloc(50);          name2 = malloc(nlen);
119          if (name2 == NULL) {          if (name2 == NULL) {
120                  fprintf(stderr, "out of memory in dev_sn_init()\n");                  fprintf(stderr, "out of memory in dev_sn_init()\n");
121                  exit(1);                  exit(1);
122          }          }
123          sprintf(name2, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",          snprintf(name2, nlen, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",
124              devinit->name,              devinit->name, d->macaddr[0], d->macaddr[1], d->macaddr[2],
             d->macaddr[0], d->macaddr[1], d->macaddr[2],  
125              d->macaddr[3], d->macaddr[4], d->macaddr[5]);              d->macaddr[3], d->macaddr[4], d->macaddr[5]);
126    
127          memory_device_register(devinit->machine->memory, name2,          memory_device_register(devinit->machine->memory, name2,

Legend:
Removed from v.9  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26