text: 
  #include <php.h>
  #include <git2.h>
  
  #include "php_git2_internal.h"
  
  PHP_FUNCTION(git_reference_normalize_name)
  {
      int libRet;
      zend_result zendParse;
      zend_string *name;
      zend_long flags;
      char *normalizedName;
      size_t normalizedMaxSize;
      zend_string *str;
  
      libRet = 0;
      normalizedMaxSize = 4096;
      zendParse = zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", \
              &name, &flags);
      if (zendParse != SUCCESS)
          RETURN_THROWS();
      normalizedName = emalloc(sizeof(char) * normalizedMaxSize);
      libRet = git_reference_normalize_name(normalizedName, \
              normalizedMaxSize, ZSTR_VAL(name), flags);
      if (libRet != GIT_OK)
          RETURN_LIBGIT2_ERROR(libRet);
      str = zend_string_init(normalizedName, strlen(normalizedName), 0);
      efree(normalizedName);
      RETURN_STR(str);
  }
  
  