Skip to content

Commit

Permalink
Minor refactoring: deleted unused comments; some type/const defines w…
Browse files Browse the repository at this point in the history
…ere moved to the beginning of the file
  • Loading branch information
krasin committed Sep 5, 2011
1 parent 11812d6 commit 05dd1bd
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions graphics_2d_example.c
Expand Up @@ -6,6 +6,9 @@
#define PROT_READ 0x1
#define PROT_WRITE 0x2

#define MAP_PRIVATE 0x02 /* Changes are private. */
#define MAP_ANONYMOUS 0x20 /* Don't use a file. */

#define NULL 0

typedef short int16_t;
Expand All @@ -20,6 +23,12 @@ typedef unsigned int* uintptr_t;
typedef long int clock_t;
typedef long int off_t;

struct timeval;
struct timespec;
struct dirent;
struct stat;


static ssize_t write(int fd, const void *buf, size_t count);
static void *malloc(size_t size);
static size_t strlen(const char *str);
Expand Down Expand Up @@ -354,19 +363,7 @@ PP_Bool Instance_DidCreate(PP_Instance instance,
}

void Instance_DidDestroy(PP_Instance instance) {
/* Find the matching item in the linked list, delete it, and patch the
* links.
*/
/* struct InstanceInfo** prev_ptr = &all_instances;
struct InstanceInfo* cur = all_instances;
while (cur) {
if (instance == cur->pp_instance) {
*prev_ptr = cur->next;
free(cur);
return;
}
prev_ptr = &cur->next;
}*/
// Don't destroy anything. It's a demo!
}

void Instance_DidChangeView(PP_Instance pp_instance,
Expand Down Expand Up @@ -549,9 +546,6 @@ enum NaClStartupInfoIndex {
NACL_STARTUP_ARGV /* argv[0] pointer. */
};

//void __pthread_initialize(void);
//void __pthread_shutdown(void);

/*
* Return the vector of auxiliary data items.
*/
Expand All @@ -561,9 +555,6 @@ Elf32_auxv_t *nacl_startup_auxv(const uint32_t info[]) {
return (Elf32_auxv_t *) &argv[info[NACL_STARTUP_ENVC] + info[NACL_STARTUP_ARGC] + 2];
}

struct timeval;
struct timespec;

#define NACL_IRT_BASIC_v0_1 "nacl-irt-basic-0.1"
struct nacl_irt_basic {
void (*exit)(int status);
Expand All @@ -574,9 +565,6 @@ struct nacl_irt_basic {
int (*sysconf)(int name, int *value);
};

struct dirent;
struct stat;

#define NACL_IRT_FDIO_v0_1 "nacl-irt-fdio-0.1"
struct nacl_irt_fdio {
int (*close)(int fd);
Expand Down Expand Up @@ -705,9 +693,6 @@ int strcmp(const char *s1, const char *s2) {
}
}

#define MAP_PRIVATE 0x02 /* Changes are private. */
#define MAP_ANONYMOUS 0x20 /* Don't use a file. */

static void *malloc(size_t size) {
void *res = 0;
int ret = ih.__libnacl_irt_memory.mmap(&res, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
Expand Down

0 comments on commit 05dd1bd

Please sign in to comment.