NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev) { FAR struct nxfe_state_s *fe; int ret; /* Sanity checking */ #ifdef CONFIG_DEBUG if (!dev) { errno = EINVAL; return NULL; } #endif /* Allocate the NX state structure. The user-space allocator is used * (if available) for compatibility with the multi-user implementation. */ fe = (FAR struct nxfe_state_s *)kuzalloc(sizeof(struct nxfe_state_s)); if (!fe) { errno = ENOMEM; return NULL; } /* Initialize and configure the server */ ret = nxsu_setup(dev, fe); if (ret < 0) { return NULL; /* nxsu_setup sets errno */ } /* Fill the initial background window */ nxbe_fill(&fe->be.bkgd, &fe->be.bkgd.bounds, fe->be.bgcolor); return (NXHANDLE)fe; }
NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev) { FAR struct nxfe_state_s *fe; int ret; /* Sanity checking */ #ifdef CONFIG_DEBUG if (!dev) { errno = EINVAL; return NULL; } #endif /* Allocate the NX state structure */ fe = (FAR struct nxfe_state_s *)zalloc(sizeof(struct nxfe_state_s)); if (!fe) { errno = ENOMEM; return NULL; } /* Initialize and configure the server */ ret = nxsu_setup(dev, fe); if (ret < 0) { return NULL; /* nxsu_setup sets errno */ } /* Fill the initial background window */ nxbe_fill(&fe->be.bkgd, &fe->be.bkgd.bounds, fe->be.bgcolor); return (NXHANDLE)fe; }