)]}'
{
  "commit": "6bfb7d64e5a9712d4951e67ec78243d2ddaa17ac",
  "tree": "712145ebe83589c707f52c1f492c034fd09083ea",
  "parents": [
    "b2ab44f63341e5bbbd4da51044d0a2b4655c926d"
  ],
  "author": {
    "name": "Patrice Dumas",
    "email": "pertusus@free.fr",
    "time": "Sun Aug 30 21:42:54 2026 +0200"
  },
  "committer": {
    "name": "Patrice Dumas",
    "email": "pertusus@free.fr",
    "time": "Sun Aug 30 21:42:54 2026 +0200"
  },
  "message": "Improve and fix memory management in C plaintext converter\n\n* tta/C/main/list_macros.h (decl_alloc_fns, def_alloc_fns): add\ninit_to_() macro function definition that reallocates and initialize\nto zero the newly allocated memory.\n\n* tta/C/convert/convert_to_plaintext.c (clear_pending_text_list)\n(release_count_context, add_top_pending_text, push_count_context)\n(COUNT_CONTEXT_STACK, PENDING_TEXT_LIST, stream_final_result)\n(plaintext_add_target_location, ensure_end_of_line)\n(merge_pending_texts, replace_pending_text, move_pending_texts)\n(align_lines, align_environment, text_heading)\n(convert_to_plaintext_internal, plaintext_free_converter): keep\nallocated count context and pending texts and reset TEXT to reuse the\nallocated memory.  Add add_top_pending_text and use it to push a\npending text that can be an already allocated pending text reused.\nRemove the second argument of push_count_context, the context pushed\ncan be reused, and can be accessed afterwards.  Change\nmerge_pending_texts such that the count context added is swapped with\nthe source count context, such that the associated allocated memory,\nif any, is kept.  Add replace_pending_text and move_pending_texts to\nadd to parent pending texts without doing the swap as with\nmerge_pending_texts, but with destruction of the memory at the\ndestination, for the case of pending text memory not reused, for\nmultitable and aligned environments.  Rename destroy_count_context as\nrelease_count_context.  Add clear_pending_text_list to reset the texts\nin the rare case when it is not already done when getting the pending\ntexts, for empty text_heading and multitable prototypes.  Deallocate\nthe count contexts and pending texts in plaintext_free_converter.\nRemove reset_count_context_stack, clear_pending_texts and\nfree_pending_texts.\n\n* tta/C/convert/convert_to_plaintext.c\n(plaintext_convert_line_new_context): leave the count context on the\nstack and pass a pointer to the pending text.  Update callers.\n\n* tta/C/convert/convert_to_plaintext.c (pending_to_text)\n(collect_pending_texts_lines): reset number of pending text to 0, in\nfunctions where the input pending texts are reset.\n\n* tta/C/convert/convert_to_plaintext.c\n(convert_to_plaintext_internal): add row_cell_lines to format_context\nand separate cells_entry_locations, remove row_cell_counts.  Call\ncollect_pending_texts_lines when processing a cell, and add cell_idx\nin format context to know the current cell index.\n\n* tta/C/convert/convert_to_plaintext.c (release_count_context)\n(align_lines, align_environment, convert_to_plaintext_internal) :\nreset images and entry locations properly, free pending lines and\nimages lists.\n\n* tta/C/convert/convert_to_plaintext.c (convert_to_plaintext_internal):\nget top formatter again after conversion, in case it was reallocated.\nRemove getting the top formatter when it cannot have changed.\n\n* tta/C/convert/convert_to_info.c (info_header),\ntta/perl/Texinfo/Convert/InfoNonXS.pm (_info_header): use new_formatter,\npush_formatter and pop_formatter in info_header too, such that\nthe formatter switches even if it is not done first.  Move enum\nformatter_type to header file.\n\n* tta/C/convert/convert_to_info.c (info_output),\ntta/perl/Texinfo/Convert/InfoNonXS.pm (output): call\nplaintext_cache_node_names before any use of node names such that\nthere is no need to check if there are already node names cached.\n\n* tta/C/convert/convert_to_plaintext.c\n(convert_to_plaintext_internal): do not pass image depth for\ndisplaymath.  Add ensure_end_of_line.\n\n* tta/C/convert/convert_to_info.c (info_output),\ntta/C/convert/convert_to_plaintext.c (plaintext_process_printindex)\n(plaintext_conversion_finalization, plaintext_insert_image)\n(convert_def_line): free extension variable, destroy element\nafter conversion, free text, always destroy parsed_def, pop last count\ncontext.  Deallocate properly element_images.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c9bd7a58ced0a1ab74ec50a49804769f50eef286",
      "old_mode": 33188,
      "old_path": "ChangeLog",
      "new_id": "b0524c05c13574c8d49ec1ada5c457d125a4f785",
      "new_mode": 33188,
      "new_path": "ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "e39beb6f700f4fa83aafed2a383f369bc5e2f01a",
      "old_mode": 33188,
      "old_path": "tta/C/convert/convert_to_info.c",
      "new_id": "8cfdbd15755c6b8b25cd9cc7463dac92e8fc1076",
      "new_mode": 33188,
      "new_path": "tta/C/convert/convert_to_info.c"
    },
    {
      "type": "modify",
      "old_id": "686b20bc649a542286145aaa98dd2dd836078256",
      "old_mode": 33188,
      "old_path": "tta/C/convert/convert_to_plaintext.c",
      "new_id": "a70e85e600a3ac62fd0d9838ca9e77b7ec61f9ed",
      "new_mode": 33188,
      "new_path": "tta/C/convert/convert_to_plaintext.c"
    },
    {
      "type": "modify",
      "old_id": "d569b0853e6cd54df62925e5e902469cc22944fe",
      "old_mode": 33188,
      "old_path": "tta/C/convert/convert_to_plaintext.h",
      "new_id": "c8bb31229a835d2b65e1a64614344b44533f1c34",
      "new_mode": 33188,
      "new_path": "tta/C/convert/convert_to_plaintext.h"
    },
    {
      "type": "modify",
      "old_id": "86eb833ac2810f089c083fd7d2176b22a9fcfa8a",
      "old_mode": 33188,
      "old_path": "tta/C/main/list_macros.h",
      "new_id": "d5de816a7a78b096e496eaf45c63b3db65c22140",
      "new_mode": 33188,
      "new_path": "tta/C/main/list_macros.h"
    },
    {
      "type": "modify",
      "old_id": "42b9603a2c42b5295f3ad66c4ca5c05d68cfb6e9",
      "old_mode": 33188,
      "old_path": "tta/C/main/plaintext_converter_state.h",
      "new_id": "19339478515e004c653ff0662a25d77f52bbfdab",
      "new_mode": 33188,
      "new_path": "tta/C/main/plaintext_converter_state.h"
    },
    {
      "type": "modify",
      "old_id": "37c04edda2caedeb9022793edfb3987f81a61d64",
      "old_mode": 33188,
      "old_path": "tta/perl/Texinfo/Convert/InfoNonXS.pm",
      "new_id": "3cf64c4f1a3d8fe23b1dbd94de30babe576677fe",
      "new_mode": 33188,
      "new_path": "tta/perl/Texinfo/Convert/InfoNonXS.pm"
    }
  ]
}
