VOLGIT



LOG | FILES | OVERVIEW


F diff --git a/git_part.c b/git_part.c --- a/git_part.c +++ b/git_part.c
#define VOLGIT_GIT_PART_C VOLGIT_GIT_PART_C
#include <git_part.h>
+ static const char *special_chars[256]
+ =
+ {
+ ['\"']="&quot;",
+ ['\'']="&apos;",
+ ['&']="&amp;",
+ ['<']="&lt;",
+ ['>']="&gt;",
+
+ };
+
int print_diff_line(const git_diff_delta *delta,const git_diff_hunk *hunk,const git_diff_line *line,FILE *out)
{
size_t i;
fprintf(out,"%c ",line->origin);
for(i=0;i<line->content_len;++i)
- fprintf(out,"%c",line->content[i]);
-
+ if(special_chars[line->content[i]])
+ {
+ fwrite(special_chars[line->content[i]],1,strlen(special_chars[line->content[i]]),out);
+ }else
+ {
+ fwrite(line->content+i,1,1,out);
+ }
fprintf(out,"</div>");
return 0;
size_t i;
git_blob *blob;
- static const char *special_chars[256]
- =
- {
- ['\"']="&quot;",
- ['\'']="&apos;",
- ['&']="&amp;",
- ['<']="&lt;",
- ['>']="&gt;",
-
- };
blob=(git_blob*)obj;