Skip to content

Instantly share code, notes, and snippets.

@stevewillard
Created October 9, 2008 05:50
Show Gist options
  • Save stevewillard/15706 to your computer and use it in GitHub Desktop.
Save stevewillard/15706 to your computer and use it in GitHub Desktop.
pushl 16(%ebp) // push the name onto the stack
call sizeof // get the size of the string
addl $4, %esp // move the stack pointer back
incl %eax // sizeof(name) + 1
pushl %eax // push sizeof(name) + 1
call allocate // malloc ( sizeof( name ) + 1 )
addl $4, %esp // move the stack pointer back
cmpl $0, %eax // malloc failed, so return 0
je allocfail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment